Skip to:
Content
Pages
Categories
Search
Top
Bottom

Prevent subscribers from having access on others profile page

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

  • Slava Abakumov
    Moderator

    @slaffik

    Try this (not tested):

    function billysgtr_hide_others_profile() {
        if ( bp_is_profile() && bp_loggedin_user_id() !== bp_displayed_user_id() ) :
            wp_redirect( home_url() );
            exit;
         endif;
    }
    add_action( 'wp', 'billysgtr_hide_others_profile', 1 );

    Slava Abakumov
    Moderator

    @slaffik

    Or use current_user_can('subscriber') instead of !== check for IDs.


    billysgtr
    Participant

    @billysgtr

    Hi Slava, thanks for the suggestions. Unfortunately, it didn’t work. I did that using if current_user_can(‘subscriber’) inside the buddypress/members/index.html

Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.
Skip to toolbar