Password protected content exposed

I have a website that has two product catalogs in it. They are both password protected yet when the user goes to the page requiring a password to access, the side column menu allows them to gain access to the products without logging in. This defeats the purpose of the password protection. Each password protected products page (links to both below) has a menu in the side column. How can I keep the menus from being visible until the users enters the password?

Please advise. Thank you.

https://www.waldfireworksdev.com/wholesale-consumer/wholesale-class-c-texas/

https://www.waldfireworksdev.com/wholesale-consumer/wholesale-class-c-missouri/

Hey There,

Thanks for posting in!

That is technically possible. However, that would fall beyond the scope of our support since it would require custom development.

You can take a look at this article:

https://wordpress.org/support/topic/hide-sidebar-content-if-page-is-password-protected/

Hope it helps and thank you for understanding.

This did not help and I do not understand. The suggested article gives me some code to put into a template that will be overwritten upon the next x theme update. Themeco should have the functions.php code snippet we can add to the child theme to resolve this issue. I have found this for numerous other themes but of course the code is theme specific. We are not asking for anything earth shattering here. Just a fix to keep side columns from displaying on a password protected page. What good is password protection when a third of the page displays and allows a user not logged in to access the page and links to other pages the password is supposed to be preventing them from accessing? This makes absolutely no sense. Who has better knowledge of the inner workings of their template code than the developer of that theme. Wow…for the first time I am extremely disappointed in the x theme and I have purchased in excess of 50 licenses.

Hello Keith,

Please understand that we always abide the standards of WordPress. By default, password protection is only applied to the post/page content in WordPress. This is why the sidebar is still visible even if you added password for the content. It is evident in this article: https://codex.wordpress.org/Using_Password_Protection

Having to remove the sidebars as well, will be done with customizations already. Just do not be disappointed just yet. Anyways, to resolve your issue, will just us the article as a reference. Since you have your child theme active and ready, please follow the following steps below:
1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
2] Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/ETHOS/WP-SIDEBAR.PHP
// -----------------------------------------------------------------------------
// Sidebar output for Ethos.
// =============================================================================

?>

<?php if ( x_get_content_layout() != 'full-width' ) : ?>

  <aside class="<?php x_sidebar_class(); ?>" role="complementary">

    <?php if ( !post_password_required() ) ?>

      <?php if ( get_option( 'ups_sidebars' ) != array() ) : ?>
        <?php dynamic_sidebar( apply_filters( 'ups_sidebar', 'sidebar-main' ) ); ?>
      <?php else : ?>
        <?php dynamic_sidebar( 'sidebar-main' ); ?>
      <?php endif; ?>

    <?php endif; ?>

  </aside>

<?php endif; ?>

3] Save the file named as wp-sidebar.php
4] Upload this file to your server in the child theme’s folder wp-content/themes/x-child/framework/views/ethos/ or wp-content/themes/pro-child/framework/views/ethos/ if you are using Pro theme.

Just make sure to create the folder path since it does not exist in your child theme yet.

Please let us know how it goes.

Please understand my frustration is not with you it is with the situation. To the laymen this does not seem like a great big deal. Anyway, please do not misplace my frustration as I greatly appreciate your assistance. I spent several hours looking for solutions, including plugins to make this work before tasking your group.

I followed your directions to a tee and they worked awesome with a couple wrinkles.

  1. It eliminates the sidebar but now the dropdowns in the main menu no longer function.
  2. The password protected page will not open using the password and the same page in the editor shows no content past the page title.

I am sure it is something simple but I have no idea. Please advise. Thank you.

Disregard my last response. I am going to lay the page out with no side column. I am creating a 2/3 + 1/3 layout and put the menu in the 1/3 and this should make the content password protected. Thanks for your effort.

You’re welcome! :slight_smile:

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.