Skip to:
Content
Pages
Categories
Search
Top
Bottom

Forum Replies Created

Viewing 1 replies (of 1 total)

  • therandomguy12345
    Participant

    @therandomguy12345

    @philipstancil

    @bphelp

    I want to hide specific users from the “(BuddyPress) Recently Active Members” & “(BuddyPress) Members” widgets (latter one is most important for me), but I don’t want these users from the members directory. So what does the below code exactly do? Does it exclude users from members directory or the widgets? Or both?

    <?php
    // Remove admin from directory
    
    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude
     
     $excluded_user='1';//comma separated ids of users whom you want to exclude
     
     if($object!='members')//hide for members only
     return $qs;
     
     $args=wp_parse_args($qs);
     
     //check if we are listing friends?, do not exclude in this case
     if(!empty($args['user_id']))
     return $qs;
     
     if(!empty($args['exclude']))
     $args['exclude']=$args['exclude'].','.$excluded_user;
     else
     $args['exclude']=$excluded_user;
     
     $qs=build_query($args);
     
     return $qs;
     
    }
    
    //Remove admin from member count
    
    add_filter('bp_get_total_member_count','bpdev_members_correct_count');
    function bpdev_members_correct_count($count){
    $excluded_users_count=1; //change it to the number of users you want to exclude
    return $count-$excluded_users_count;
    }
    ?>
Viewing 1 replies (of 1 total)
Skip to toolbar