Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide newly registered member pages


  • ritusingh01
    Participant

    @ritusingh01

    Hi there,

    I am creating a function for my site in which I want to hide member’s profile pages which have not complete their extended profile fields information.
    Is there any way I can achieve this?

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

  • Venutius
    Moderator

    @venutius

    The complexity of this depends on exactly where you want to hide these users. an example is how to hide them from the members list page, ass follows:

    function ritusing_members_loop_excludes( $retval ) {
    
        if ( bp_is_members_directory() ) {
    
            $excluded_users = array( 34,35,36);
    
            $retval['exclude'] = $excluded_users;
        }
    
        return $retval;
    }
    add_filter( 'bp_before_has_members_parse_args', 'ritusing_members_loop_excludes' );

    Obviously you would need to add code to select the excluded user list and turn it into a comma delimited list.


    ritusingh01
    Participant

    @ritusingh01

    Thank you @venutius for the quick response.

    The code you provided I can use on member list page to hide members with an incomplete profile. I have found a way of calculating member’s profile completeness percentage.

    Will it be good using template_redirect hook to redirect member profile pages with incomplete profile. For eg. http://domain.com/members/jeeny/ to reditect on http://domain.com


    Antonia Cummins
    Participant

    @antoniacummins

    thanks


    Venutius
    Moderator

    @venutius

    Here is a profile redirect script:

    function bpfr_hide_admins_profile() {
    global $bp;
    if(bp_is_profile && $bp->displayed_user->id == 1 && $bp->loggedin_user->id != 1) :
    wp_redirect( home_url() );
    exit;
    endif;
    }
    add_action( 'wp', 'bpfr_hide_admins_profile', 1 );

    This one redirects for user_id == 1, you could replace this with a function that checks the profile completeness.


    ritusingh01
    Participant

    @ritusingh01

    Thanks a lot, @venutius 🙂

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