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.
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
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.
Thanks a lot, @venutius 🙂