Hide a Page

Hi,

Some of the pages that I am trying to hide continue to show up for everyone. Groups plugin protection only works with some of my pages and not will all pages that I am trying to protect.

Here is what I did: I purchased a few of your plugins to set Groups in my WordPress with WooCommerce. I setup a “premium” group for my paid users and I set Access restrictions for ALL Post types in Groups options. I then successfully hid a few pages from “non-premium” users by Restricting the visibility in the Groups field withing each page.

The problem began when I tried to hide some “empty” pages that I created for my GeoDirectory plugin to display its features. If I set any such page on behalf of GeoDirectory with a Group Access restriction, it does not hide the page from the public. I contacted GeoDirectory and they suggested that I contact the developer of the plugin that I purchased to hide my pages/posts/categories/products.

Please help as this is critical form my site to function as intended. I need to be able to hide any page/post/category/product that I create in WordPress, including GeoDirectory pages.

Thank you


Comments

12 responses to “Hide a Page”

  1. This issue should be fixed in the last version.

  2. Hey Antonio,

    Thank you for the above solution. It works much better, however, I found 2 issues that need a solution: (1) with WooCommerce and (2) with 404 pages.

    (1) The function above now successfully redirects all pages hidden by the Groups protection. But this redirect now includes the “my-account” page, which is the initial user login page with WooCommerce with all account information. How can we make it work without redirecting the “my-account” page after a successful login? NOTE: The “my-account” page does work while any user tries to login; once logged in, the redirect is triggered towards the home page, instead of the WooCommerce “my-account” page.

    (2) Also, all non-existing pages (that are supposed to trigger the 404 error) now get redirected to the home page. Any ideas? Suggestions?

    Thank you. Great job!

    Best regards,

    Alex

    1. antonio Avatar
      antonio

      Hi Alex,
      Sorry for the delay, you can try to change:
      if ( !Groups_Post_Access::user_can_read_post( $post->ID, get_current_user_id() ) ) {
      to
      if ( ( !Groups_Post_Access::user_can_read_post( $post->ID, get_current_user_id() ) && ( $post->ID !== get_option('woocommerce_myaccount_page_id', '') ) ) {
      Kind Regards,
      Antonio B.

  3. Hi Alex,
    It seems that plugins are not 100% compatible.
    This code solves part of the problem:
    add_action('wp', 'my_wp', 10);
    function my_wp () {
    global $post;

    if ( !Groups_Post_Access::user_can_read_post( $post->ID, get_current_user_id() ) ) {
    wp_redirect( get_home_url(), $redirect_status );
    exit;
    }
    }

    You need to change the wp_redirect param for redirect to another page.
    Kind Regards,
    Antonio B.

  4. Hey Antonio, after extensive testing on multiple websites for the last few days, I noticed that ALL pages created in WordPress, which are setup for any plugin to use as an “empty” page in order for the plugin to populate user content, are NOT protected/hidden with the Groups /Groups WooCommerce plugins. This causes a major problem for functionality if one needs to protect/hide a page from non-members or non-paying customers.

    Therefore, it is not just a Geodirectory plugin issue. The exact same issue applies with BuddyPress and BBpress popular plugins. While testing, I ONLY activated my purchased Itthinx plugins and any plugin that requires an “empty” page to function: like BuddyPress, BBPress, Geodirectory – one at a time, in order to avoid code conflicts.

    Please help as I need to be able to use the Groups plugins functionality with many of my customer’s websites. Thank you,

    Alex

    1. antonio Avatar
      antonio

      Hi Alex,
      Right, there seems to be some problem with it, we’re reviewing it.
      Thanks for letting us know.
      Cheers

  5. Hey Antonio,

    Thank you for your response. I am not sure if you got it but I answered your email. As you suggested, I tested it without any additional plugins and another template and it does not hide all that I set to hide with the Groups Restriction plugin.

    Thanks,

    Alex

    1. Hi Alex,
      Sorry, really using this code it’s not an easy solution.
      We’re working to add this functionality to the Groups Restrict Categories plugin.
      Kind Regards,
      Antonio B.

      1. Sorry, this is not related with this topic !!

  6. Hey Antonio,

    I sent you an email with your login.

    Thank you very much for your help.

    Kind Regards,

    Alex

    PS. How do I delete the duplicate Topic?

    1. Thanks,
      It seems to conflict with another plugin, answered by email.
      Do not worry about the duplicate topic.
      Kind Regards,
      Antonio B.

  7. Hi Alex,
    Maybe there is a conflict with another plugin. Please send me dashboard admin access to antonio[at]itthinx[dot]com indicating this topic and a GeoDirectory page that is not hidden, and I’ll have a look at this.
    Kind Regards,
    Antonio B.

Share