WordPress.org

Ready to get started?Download WordPress

Forums

Passworded pages (need cookie to expire.) (6 posts)

  1. oyon
    Member
    Posted 9 years ago #

    Hey guys. Would just like to know if there's any easy way (maybe a plugin?) to adjust how long the cookie takes to expire for password protected pages. My site will have a student/teacher audience and may be accessed at the same computer so I'm fairly keen to make use of this cool little feature.

    I don't really want to hunt around in the wp code to find where this is set because (a.) while I could probably do an ugly hack, I don't really know what I'm doing and (b.) I'd need to redo it when a new version came along.

    Anybody know anything about this ? Any suggestions much appreciated, James.

  2. Kafkaesqui

    Posted 9 years ago #

  3. oyon
    Member
    Posted 9 years ago #

    Cool, thanks for that link, looks like a handy plugin but not really what I was after (although I'll probably use it once I start giving out accounts...)

    The cookie I'm interested in is the one that control access to individually passworded published WP pages. It's independant of login and persists for a long time. Perhaps I can work something out from that plugin if I drink enough coffee tonight.

  4. Kafkaesqui

    Posted 9 years ago #

    Sorry, I thought it handled post passwords, too.

    Well, you could hack wp-pass.php for this. In that file, look for:

    // 10 days
    setcookie('wp-postpass_' . COOKIEHASH, $_POST['post_password'], time() + 864000, COOKIEPATH);

    The number (864000) is the amount of seconds the wp-postpass cookie remains valid.

  5. oyon
    Member
    Posted 9 years ago #

    Cheers for that, it should really help. WordPress people are so damn nice....

    James.

  6. Paul
    Member
    Posted 8 years ago #

    Wow! I didn't expect to find this answer in the support forums, but it was here! This is exactly what I needed, as I'm having the exact same problem as the FreeMoby describes on the plugin page. Thanks a ton!!!!

Topic Closed

This topic has been closed to new replies.

About this Topic