• Resolved Anton

    (@nat0n)


    Hi, is it possible to have the “global” events listing use HTTPS for centrally stored events but HTTP for all sub-site events?

    I have the WP HTTPS plugin installed now that I presume takes over everything with regards to HTTPS links, but I figured I could try post about it here as well, don’t know enough to grasp where the problem lies.

    I do have a certificate for the root site but not for sub sites, and I’d prefer to keep it that way (for cost reasons..) for now.

    https://wordpress.org/plugins/events-manager/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    can you try this snippet?

    function my_em_force_ssl( $template ){
    	if( !is_ssl() && em_is_event_page() ){
    		wp_redirect(str_replace('http:','https:', get_permalink()));
    		die();
    	}
    	return $template;
    }
    add_filter('template_redirect', 'my_em_force_ssl', 10 );

    As for where to paste this : http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/

    Thread Starter Anton

    (@nat0n)

    Thanks, but that didn’t seem to do the trick :/ I deleted (WP Super Cache) cache and reloaded couple of times but still see all links (here btw: https://omställning.net/evenemang/) turn up with HTTPS, where I want only some of them (the “root” links) to do so.

    Not tested, but I think you’d need to modify Angelo’s code a little to check against network_site_url() for the site currently being viewed.

    Something like this:

    function my_em_force_ssl( $template ){
    	if( !is_ssl() && em_is_event_page() && network_site_url() == 'whatever.com'){
    		wp_redirect(str_replace('http:','https:', get_permalink()));
    		die();
    	}
    	return $template;
    }
    add_filter('template_redirect', 'my_em_force_ssl', 10 );

    Thread Starter Anton

    (@nat0n)

    Sorry, not that either. Even changing the is_ssl() to being non-negative doesn’t seem to make any difference – always http:// on all links.. Maybe the HTTPS plugin is too aggressive..?

    It sounds like the snippet is being ignored or overwritten. It would be worth experimenting with different values for the 10 part to change priority.

    Otherwise, I’d suggested checking with the support for that plugin to see what suggestions they have.

    Thread Starter Anton

    (@nat0n)

    I must be terrible at both explaining problems and reading through proposals for fixes.. This is what fixed it for me:

    if( is_ssl() && em_is_events_page() ){

    Missed both the events and the !is_ssl thingie, sorry about that. Glad you got me on the right track though, couldn’t have guessed/found what filter to use without your help.

    Plugin Support angelo_nwl

    (@angelo_nwl)

    glad you already sorted this out.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘HTTPS for "global" events but HTTP for sub-site events?’ is closed to new replies.