WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Password Protecting a "Page" tab (3 posts)

  1. mhains
    Member
    Posted 8 years ago #

    Hello,

    I'd like to have a tab on my site labeled "baby" with personal photos that are only visible to those who enter a password.

    The photos are being pulled down from Flickr by Falbum, but "Pages" don't support PHP directly, I'm finding. As a result, I've created a template page that does allow the "Baby" tab on my site to show the photos -- unfortunately, the password protection doesn't work. I've added the "content()" within the template "baby.php" but that only protects the text within the "Page" entry, not the subsequent Falbum spitting out private Flickr photos.

    Anyone know how to force a user to enter a password before they can view the contents of a "Page" tab?

    Thanks!
    Michael Hainsworth
    http://www.hainsworth.com

  2. Wrap your private stuff in this:

    if (stripslashes($_COOKIE['wp-postpass_' . COOKIEHASH]) === $post->post_password) {
    // your stuff here
    }

    I think that'll do it.

  3. mhains
    Member
    Posted 8 years ago #

    FANTASTIC. Thank you very much.

Topic Closed

This topic has been closed to new replies.

About this Topic