WordPress.org

Ready to get started?Download WordPress

Forums

Multiple Passwords for Protected Pages
Login automatic after browser close (7 posts)

  1. tomas2r
    Member
    Posted 1 year ago #

    Hello,

    My clients are saying that after they login to the protected page, the login is by-passed upon a re-vist to the site. After the browser is closed and the computer restarted, the login to the protected page is no longer required.

    http://cecwecare.org/?page_id=1176

    dSPWsnH9 is one of the logins

    http://wordpress.org/extend/plugins/baw-multiple-pass-for-protected-pages/

  2. graphfx21
    Member
    Posted 1 year ago #

    You need to reset the cookie, it is naturally set to 10 days.

    add_action('wp_head', 'setCookiePasswordTime');
    
    function setCookiePasswordTime()    {
        setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 10, COOKIEPATH);
    }

    This sets the cookie to expire after 10 seconds, you can set it to whatever you like. Just put this code in your functions.php file.

  3. tomas2r
    Member
    Posted 1 year ago #

    Ouch! That zapped the entire site when I updated the .php . I get all pages blank, and can't login via admin. I will have to access the FTP area to edit this out.

  4. webpdq
    Member
    Posted 1 year ago #

    I tried the same code in my wp-includes/functions.php and it blew up my site up.
    Error
    Fatal error: Call to undefined function add_action() in /home/specialc/public_html/wp-includes/functions.php on line 29

    [ Please do not bump, that's not permitted here. ]

  5. graphfx21
    Member
    Posted 11 months ago #

    You have to put this in your theme's functions.php file.

  6. Julio Potier
    Member
    Plugin Author

    Posted 6 months ago #

    Hello

    This is the way WordPress does his thing with post password.

    @graphfx21 : you can't do a set cookie in the header, you have to do it in "template_redirect" for example.

  7. webpdq
    Member
    Posted 6 months ago #

    I edited the themes/canvas/functions.php and got this error message
    html/wp-content/themes/canvas/header.php:22) in /home/specialc/public_html/wp-content/themes/canvas/functions.php on line 97

    Could you please tell us exactly which file to add the code to? I do not have a file called template_redirect.

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.