• coloradorepertorysingers

    (@coloradorepertorysingers)


    We have a password-protected page on our site. Recently, it has stopped asking for the password when visited. In the visibility settings, it still says it is password protected and still has an associated password.

    I’ve tried resetting the password, changing it back to public and then returning it to password protection, installing a password plug-in, and nothing has worked.

    Looking for advice!

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    The linked current members page is supposed to be protected? That page appears to be using a special template to list events. The password protection by default only applies to page content, not other template output. It appears the page has no content of its own from the editor, or the template does not use it. All page content seems to be event posts, not editor content.

    For password protection to work on such a page, the template needs to be modified to make use of post_password_required() to check for password requirement and then use get_the_password_form() if it is required.

    Thread Starter coloradorepertorysingers

    (@coloradorepertorysingers)

    Yes, the entire current members page is supposed to be protected. When we first set up this site a couple years ago, it was: when you navigated to this link, you were prompted for a password before you saw any of the posts or the sidebar. This page is used for our internal choir members only, so it has documents and internal choir info about rehearsals, performances, etc.

    I’ve tried password protecting the posts individually, but the sidebar is still visible to the public. I’m just not certain why the functionality has changed and would love to make an adjustment to get back our previous functionality to block the entire page (posts and sidebar) from public view unless a password is entered.

    I am having exact same problem. We migrated a website to managed WP hosting at godaddy a couple weeks ago and the password protected page worked fine. I could not look at it, even viewing page from WP back end, without entering the password.

    All of a sudden everyone can view the page – the title says “Protected:(page_title) but all of the content is visible. Ive tried different browsers. Ive tried different computers. Ive tried clearing the cache in all those browsers. Ive tried flushing the cache on back end. Ive tried deactivating/reactivating the password protection. Nothing works. I actually updated the permalink settings to fix another issue so thats been done as well. We did recently updated the theme to the latest version so im not sure if that has anything to do with it.

    Now i see what you are talking about with the content feeds. Yes we have nothing in the main content area – we have a content builder called goodlayers which feeds in all the content. But again, the password protection worked just a couple weeks ago even with the content feeds. I did try adding some text in the main content area to see if it would force password protection on the page but it did nothing. ANy help would be much appreciated.

    As i investigate further, i did see that anything i put in the content area IS password protected at the bottom of the page, but trying to rebuild the whole page with all of the content in the main content area (since it is fed from many other sources) will be a huge pain.

    Thanks

    Moderator bcworkz

    (@bcworkz)

    @coloradorepertorysingers – I’m sorry I missed your last post. I suspect notifications are not always making it through ??

    Anyway, I cannot explain why password protection once protected non-page content template content but does not now. What matters now is how to protect template content. You need to alter your theme’s page.php template. If your theme does not have page.php, create one from a copy of index.php. To protect your modified template from being overwritten when the theme is updated, you should create a child theme and keep your template there.

    Identify the portion of the template that you want to protect so it can be separated from unprotected content such as title and footer. At the beginning of the protected portion insert this:

    <?php
    // If post password required and it doesn't match the cookie.
    if ( post_password_required( get_the_ID())) {
        echo get_the_password_form( get_theID());
    } else {
    ?>

    and at the end of protection add this:
    <?php } ?>

    I’m assuming this code will be placed within template HTML. If it needs to be placed within an existing <?php ?> block, do not use those delimiters in my above code again. Nested PHP blocks causes a syntax error. Be sure where you insert this code is not within any loop code on the template, usually started with while or foreach.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Password protected page doesn’t prompt for password’ is closed to new replies.