WordPress.org

Ready to get started?Download WordPress

Forums

Password protect page remembers (6 posts)

  1. Dave Redfern
    Member
    Posted 4 years ago #

    Hello,

    I am using password protection of some pages but it seems to set a cookie once the password is entered to remember to login. Is there a way logout or stop wordpress creating this plugin so you have to log in each time?

    Thanks

    Dave.

  2. fruitybeetle
    Member
    Posted 4 years ago #

    Hello,

    I'm looking for the same thing - I don't mind users only logging in once to a protected page all the time the browser is open, but if the browser is closed, I want them to have to log in again the next time they visit the page. Any ideas?

    Paul

  3. overhaulmedia
    Member
    Posted 4 years ago #

    I am looking for the same thing! Any word?

  4. kwyjibo_AT
    Member
    Posted 4 years ago #

    Hi there!

    Check out wp-pass.php in your wordpress directory.
    You'll find a line like this:
    setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 2, COOKIEPATH);
    The value after the "+" indicates the time in seconds, the cookie stays valid. In this example it is valid for 2 seconds, setting it to 7200 would be equivalent to 2 hours.

    This solution works for me.
    You may find further information on:

    http://www.php.net/manual/en/function.setcookie.php

    Greetings
    matthias

  5. phuile
    Member
    Posted 3 years ago #

    I tried this, but it didn't work :(
    I have tried deleting files and cookies. But when I got back into the website and click on the page, it is already logged in. What else have I got to do to make this work?
    Thanks!

  6. nickolia
    Member
    Posted 3 years ago #

    This worked perfectly for me. Just make sure you go into your cookies and delete the current wp-postpass_... cookie that is there as it will not overwrite it, but has to be deleted before the new 2 sec cookie takes it's place.

Topic Closed

This topic has been closed to new replies.

About this Topic