Find Answers and Get Support › Forums › Gwangi – PRO Multi-Purpose Membership, Social Network & BuddyPress Community Theme › Popular Features › Members Directory › How to hide admin from members page
- This topic has 5 replies, 2 voices, and was last updated 3 years, 9 months ago by
Manathan.
-
AuthorPosts
-
Saad IbraParticipant@sio80
- 2 Topics
- 6 Posts
Hello,
I am currently working on setting the site on a local hosting and I am facing a problem with hiding the admin from the members page, I went to the support forums and read an article on this link Here and applied the second code, but this message appeared at the top of the site.Regards
July 10, 2021 at 16:58 #33388@themodactyl- 0 Topics
- 6737 Posts
Hi @sio80,
Thank you very much for reaching out! 🙂
We wrote a tutorial in our documentation about this. To find out more, please click on the following link: How to Hide Admin Users in the Members Directory?.
If you have further questions or requests, feel free to create other forum topics.
We remain available for all matters related with our theme!
Cheers,
July 12, 2021 at 10:23 #33402@themodactyl- 0 Topics
- 6737 Posts
Hi Saad,
Thank you for your feedback. I’m sorry to read this article doesn’t help you get what you’re trying to achieve. Unfortunately, we have no clue on how to solve this. 🤔
Please be aware that the directory is managed by BuddyPress. As this issue is related with this plugin, it’s best if you try to reach the plugin authors. They will be more informed and better suited to help you.
To go further, we invite you to post your request on their support forums: buddypress.org/support
Don’t hesitate to share the solution with us. I’m sure it will help other users facing the same issue. By doing this, you will be making a great contribution to this forum, and we thank you very much for that! #SharingIsCaring 💪🏻
Best,
July 13, 2021 at 09:23 #33424Saad IbraParticipant@sio80- 2 Topics
- 6 Posts
Hello,
I did it 🙂
To hide admin from members page as well as widgets…etc, use this code. I modified it out of experience, not knowledge, and the result is great./** * Exclude Members from BuddyPress Members List. * * @param string $qs query string. * @param string $object object name(members, groups etc). * * @return string */ function bpdev_exclude_users( $qs = '', $object = '' ) { // 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; } add_action( 'bp_ajax_querystring', 'bpdev_exclude_users', 20, 2 ); // Exclude Admins from Directories and BP Widgets add_filter( 'bp_after_has_members_parse_args', 'buddydev_exclude_users' ); function buddydev_exclude_users( $args ) { //do not exclude in admin $excluded = isset( $args['exclude'] )? $args['exclude'] : array(); if( !is_array( $excluded ) ) { $excluded = explode(',', $excluded ); } $user_ids = array( 1, ); // enter user ids here $excluded = array_merge( $excluded, $user_ids ); $args['exclude'] = $excluded; return $args; }
Regards
July 14, 2021 at 23:53 #33457@themodactyl- 0 Topics
- 6737 Posts
Hi @sio80,
I’m glad to read you’ve been able to solve this issue!
We thank you for sharing the solution with us. I’m sure it will help other users facing the same issue. By doing this, you’re making a great contribution to this forum, and we thank you very much for that! #SharingIsCaring 💪🏻
Cheers,
July 15, 2021 at 08:47 #33468 -
AuthorPosts
Hi there,
This topic has been inactive for a while now so we will be closing it to keep the forum tidy. Don't hesitate to create a new topic if you still need help and we'll be glad to help you!
Best regards,
The Themosaurus team.
The topic ‘How to hide admin from members page’ is closed to new replies.