Skip to:
Content
Pages
Categories
Search
Top
Bottom

Hide members

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

  • beforeplastic
    Participant

    @beforeplastic

    PS. Maybe hide by member type? or in the admin panel is there a checkbox? When I check ” Exclude user from Author-sitemap” the member still shows up under members.


    beforeplastic
    Participant

    @beforeplastic

    I found this. May I made a feature enhancement request to add each of these code features to enable a check box in the users section of the admin panel? Having to manually add the ID of new users to hide isn’t practical: https://buddypress.org/support/topic/hide-admin-from-members-and-activity/:

    // Remove admin from the member directory
    function bpdev_exclude_users($qs=false,$object=false){

    $excluded_user=’1′; // Id’s to remove, separated by comma

    if($object != ‘members’ && $object != ‘friends’)// hide admin to members & friends
    return $qs;

    $args=wp_parse_args($qs);

    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;

    }
    add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);

    // once admin is removed, we must recount the members !
    function bpfr_hide_get_total_filter($count){
    return $count-1;
    }
    add_filter(‘bp_get_total_member_count’,’bpfr_hide_get_total_filter’);


    beforeplastic
    Participant

    @beforeplastic

    We have to update these two lines of code for each user correct?

    $excluded_user=’1′;
    add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);


    shanebp
    Moderator

    @shanebp

    No, just $excluded_user='1, 23, 267';
    And please use the code button when posting code.


    mpek
    Participant

    @mpek

    Just looked up a solution for this and found a topic wishing this to be included 3 years ago and now this most recent one.

    I’m wondering if it’s possible to include this function, to be able to exclude specific members from showing up…?


    beforeplastic
    Participant

    @beforeplastic

    Re: Hiding admins from member list:

    In looking back at all of these threads I realize we didn’t jot down the root path to the file we need to update with this code: $excluded_user=’1, 23, 267′;

    Can someone provide the path to get to this file? I can’t seem to find it again.

    example: wp-content/buddypress/bp-themes/otherfoldername/filename.php


    shanebp
    Moderator

    @shanebp

    You need to create the code. Do so in bp-custom.php.


    beforeplastic
    Participant

    @beforeplastic

    Thank you but that doesn’t provide me the path the original file I was directed to update where I needed to add the ID numbers. I still need to know where that file lives.

    For this new solution, what is the latest “official” complete code I should include in the new bp-custom.php file? The link you provided is asking me to create a new file if it didn’t exist. I did that adding it here in the plugins folder: public_html/wp-content/plugins

    Including this code as a starting point:

    <?php
    // hacks and mods will go here
    ?>
    —————————–
    Is the below the correct and complete code to use?

    // Remove admin from the member directory
    function bpdev_exclude_users($qs=false,$object=false){

    $excluded_user=’1′; // Id’s to remove, separated by comma

    if($object != ‘members’ && $object != ‘friends’)// hide admin to members & friends
    return $qs;

    $args=wp_parse_args($qs);

    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;

    }
    add_action(‘bp_ajax_querystring’,’bpdev_exclude_users’,20,2);

    // once admin is removed, we must recount the members !
    function bpfr_hide_get_total_filter($count){
    return $count-1;
    }
    add_filter(‘bp_get_total_member_count’,’bpfr_hide_get_total_filter’);


    beforeplastic
    Participant

    @beforeplastic

    PS, I just added that code and it broke my site with the following error:
    Parse error: syntax error, unexpected ‘,’ in /home/mysite/public_html/wp-content/plugins/bp-custom.php on line 7


    Peter Hardy-vanDoorn
    Participant

    @petervandoorn

    Hi. I struggled with this for a while, and I agree entirely that something like this needs to be in the BuddyPress core… actually, I think much better user management needs to be in the WordPress core, not just BuddyPress, but that’s a discussion for another time…

    I eventually found the code that you’re using and modified it to be able to ignore all users with a specific WP role or roles, thus removing the need to hard-code specific user IDs.

    To manage user roles you’ll need a plugin such as User Role Editor by Vladimir Garagulya and create a new role that you assign to users who you want excluded (I chose “suspended”). If you use URE you can assign this as an additional role to the main one that WordPress allows you to set.

    The code is here: http://pastebin.com/9xYALGfR, but I’m no PHP expert, so offer no assurances… all I can say is that it works for me 🙂


    lookingahead
    Participant

    @lookingahead

    so, @shanebp forgive me if resurrecting this thread is a bad idea, but it has the information in it that i have a question on, and i figured it’s easier to use this one to talk about my issue rather than create a new thread and link back here.

    i looked at the bp-custom.php file you linked to for this issue and i’m unsure where i can find the correct code to use with it….because i am actually not trying to merely hide members from the directory, but am instead trying to hide them from the directory and ALL other users on the site. i want to make it so that the user profiles basically are unreachable…along with each user’s information.

    so i believe (not sure, but i believe) that to achieve this is i would need to make sure the profiles are handled in one of the following ways:
    – password protected from view, accessible only to admins/keymaster
    – never loaded at all somehow, via bp-custom.php
    – the template for user profiles is blanked out somehow, so information is never put in them
    – get the buddypress profile for users — when clicking on an avatar — just redirect to the main site page

    of course, i have no idea if these guesses are the way to achieve the goal i really want….which is to have only one profile used (i’m using woocommerce’s account screen for their profiles)……i have no need for a buddypress profile to be used in addition to the woocommerce account profile page that i have them already using.

    i honestly just want each user’s personal profile page in buddypress to be disabled. so they can’t see their own profile or any profile of others.

    whether that involves forwarding users to the site main page when they click on a user, or (ideally) not being clickable at all, or….oh, i don’t know. as long as no buddypress profile is viewable by any member in any way. not even by the buddypress user themselves.

    and yes — this would also include hiding member names from search.

    note: i don’t care if they can see the member list in the hidden group forums; that is the only place i care to see members listed. but i don’t want those member avatars to be clickable in a hidden group forum. not ever.

    thoughts????


    jc123
    Participant

    @jc123

    I am using redirect the member page to home page. This is not an ideal method but the easiest method as of now. Hope there is a feature to disable the member list page from members view in future.

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