WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Password Protect Page - Custom Template (8 posts)

  1. aebrigham
    Member
    Posted 4 years ago #

    Quick Question.

    I have created a custom template for a page... created a file called rsvp-template.php and put it in the theme's directory. Inserted the code I wanted, which is really just basic Form HTML...

    If I go into the WordPress Dashboard and Password protect the page, it doesn't work with the custom template. If I revert back to the Default Template, of course my page won't be the same, but the password protected page works.

    Any help would be appreciated.

  2. BPartch
    Member
    Posted 4 years ago #

    It's working for me at my blog: http://benpartch.org/password-protected-test-page/ Password is password

    Did you select the custom page template from the drop down list while creating the page in question?

  3. aebrigham
    Member
    Posted 4 years ago #

    Hi BPartch,

    Thank-you I was able to resolve this.

    ...Andrew

  4. newtrouble
    Member
    Posted 4 years ago #

    Hi Andrew

    How did you resolve it? I'm having big problems with the password protected feature. First it worked fine. Now no matter what template I use it won't work at all.

  5. charlesgallant
    Member
    Posted 4 years ago #

    Yes - please tell! I've read in another thread that post_password_required() will return true/false depending on whether or not the user is authenticated, but the details were left out :\

    Thanks,
    C

  6. natalievi
    Member
    Posted 4 years ago #

    Yes! Please share. I've been trying to figure this out for a long time, and no resolution has worked for me. I know it has to do with custom templates.

    How did you fix it??

  7. David Rogers
    Member
    Posted 4 years ago #

    ditto!!
    There has to be a solution to this.

  8. Andy Potanin
    Member
    Posted 4 years ago #

    In case you are looking to modify the generic "This post is password protected. To view.." form, you can add a filter into the functions.php file, like so:

    <?php
    add_filter('the_password_form', 'custom_the_password_form');
    
    function custom_the_password_form() {
      $output = 'YOUR CUSTOM FORM AND TEXT HERE';
      return $output;
    }
    ?>

    You can view the original code in post-template.php on lines 1132 - 1141.

Topic Closed

This topic has been closed to new replies.

About this Topic