This topic has 6 replies, 3 voices, and was last updated 9 years by abidjan-loves.

  • Author
  • #22524
     maxdestefano
    Participant

    Hello,

    I would like not to show some users in the members list.

    For example I don’t want admins to be shown in the members list.

    Thanks,
    Max

    #22840
     Catalin
    Moderator

    Hello,

    Please take a look at this link:

    https://gist.github.com/sbrajesh/2142009#file-hide-subscribers-php

    You can use the code to hide admin users, you need to change the last function.

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #22847
     maxdestefano
    Participant

    Hello Catalin,

    Thanks for your answer.

    I copied and pasted this code inside the bp-custom.php file, and it seems to work great in the members list page.

    However, I still have to hide the admins from a couple of sections:
    – the online users widget
    – the members list widget

    The code you suggested me seems not to do that. Could you please help?

    Thanks
    Max

    #23040
     abidjan-loves
    Participant

    Hi. I use this code and it works for me so `/**
    * HIDE ADMIN
    */

    add_action(‘bp_init’, ‘kleo_private_admin’);
    function kleo_private_admin(){
    global $bp;
    if(is_super_admin())
    {
    remove_action(“wp_head”,”bp_core_record_activity”); //id SM is on, remove the record activity hook
    //then remove the last activity, if present
    delete_user_meta($bp->loggedin_user->id, ‘last_activity’);
    }
    }

    add_action(‘bp_ajax_querystring’,’kleo_exclude_users’,20,2);
    function kleo_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;
    }`

    You can find it at this toptic : Hide Admin from site members

    #23077
     maxdestefano
    Participant

    Hi,

    Thanks for your answer. This also works fine for the “members” PAGE, but not for the “who’s online” and the “members” WIDGETS.
    Is there any solution for those two WIDGETS as well?

    Thanks
    Max

    #23199
     Catalin
    Moderator

    Hello,

    Those widgets are a part of BuddyPress plugin. Please try their forum support for a solution.

    Thank you,
    Catalin

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #46873
     abidjan-loves
    Participant

    Hi ,
    well you can use Members With Uploaded Avatars Widget plugin for widget
    http://buddydev.com/plugins/buddypress-members-with-uploaded-avatars-widget/
    Thank you,

Viewing 7 posts - 1 through 7 (of 7 total)

The topic ‘Hide some users in members list’ is closed to new replies.

Log in with your credentials

Forgot your details?