WordPress.org

Support

Support » Plugins and Hacks » [Resolved] [Plugin: WordPress HTTPS (SSL)] Force SSL for users

[Resolved] [Plugin: WordPress HTTPS (SSL)] Force SSL for users

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mike Ems

    @mvied

    So you want to secure all links for logged in users?

    You could do that pretty easily by adding this to your theme’s functions.php:

    function logged_in_force_ssl( $force_ssl, $post_id ) {
        if ( is_user_logged_in() ) {
            $force_ssl = true;
        }
        return $force_ssl;
    }
    add_filter('force_ssl', 'logged_in_force_ssl', 10, 2);

    It may not work perfectly. Let me know.

    thanks very much. this works great. but i am wondering, when logged out, it doesn’t go back to the non secure version of my site. is there a way to force it to be non secure http when not logged in?

    Plugin Author Mike Ems

    @mvied

    Same code, add an else statement.

    function logged_in_force_ssl( $force_ssl, $post_id ) {
        if ( is_user_logged_in() ) {
            $force_ssl = true;
        } else {
            $force_ssl = false;
        }
        return $force_ssl;
    }
    add_filter('force_ssl', 'logged_in_force_ssl', 10, 2);
    G

    @gnetworkau

    @mvied
    I tried the above code, but had problem – white screen of death…
    So too trying your WordPress https plugin.

    I want ssl active for logged in users, http for guests.

    WordPress 3.5 (Network), Buddypress 1.6.2, WP-Super-cache 1.2

    Any ideas?

    G

    @gnetworkau

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] [Plugin: WordPress HTTPS (SSL)] Force SSL for users’ is closed to new replies.