Skip to:
Content
Pages
Categories
Search
Top
Bottom

BP member pages visibility restriction?


  • joesegal
    Participant

    @joesegal

    Hello! I found a page indexed on Google that I don’t want to be. Its like I’m noticing some pages that I think shouldn’t be visible to unlogged in users coming up on Google and being visible like this one

    http://www.mysitezyz.com/members/janedoe/friends/ so,

    is there a way to set the page visibility on the members/friends please?

    Thanks!
    Joe

Viewing 3 replies - 1 through 3 (of 3 total)

  • PinkishHue
    Participant

    @pinkishhue

    Hi Joe,

    I don’t think there is a setting you can change for that specifically but you can restrict access to the content on that page and similar pages by adding a conditional in to their templates.

    You need to copy over the relevant template from here:

    …\wp-content\plugins\buddypress\bp-templates\bp-legacy\buddypress\

    and put it in to your theme here:

    …\wp-content\themes\your-theme\buddypress\

    so for example for that particular page, the friends list on a user profile, you would copy this file:

    …\wp-content\plugins\buddypress\bp-templates\bp-legacy\buddypress\members\single\friends.php

    and put it here:

    …\wp-content\themes\your-theme\buddypress\members\single\friends.php

    then open up that file in a text editor and add this code near the top (under the first closing ?>)

    <?php if ( is_user_logged_in() ) : ?>

    Then right at the end of that file, add this code:

    <?php endif; ?>

    That should work but I haven’t tested it as I don’t have access to my main PC right now. That will show the normal header and footer but none of the friends list content.

    Alternatively if you wanted to show an error message like ‘you need to be logged in’ you could use something like this in place of that first snippet of code:

    <?php if ( !is_user_logged_in() ) : ?>
    
    <p>You need to be logged in to view this content</p>
    
    <?php else : ?>

    Hope that helps 🙂


    djsteveb
    Participant

    @djsteveb

    @pinkishhue – interesting code – I hope it works!

    I’d love to see an exta if then statement for the header where someone in this situation could have a:

    meta name ‘robots’ “noindex, nofollow” added – if on a “members” page – this would help fix the OPs problem even more / better.


    djsteveb
    Participant

    @djsteveb

    searching the wp-repo fro something else – and found this – https://wordpress.org/plugins/members-page-only-for-logged-in-users/

    not sure if it works with current versions of things – may work – or may be helpful in finding the right code for whatever.

    I think any system for preventing member view (or other page / pseudo page views) should have an optional setting to send a 403 access denied server code – may help with some things.

    /random thoughts

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘BP member pages visibility restriction?’ is closed to new replies.
Skip to toolbar