This is the bar and menu I am trying to get rid of:
While this is the bar I’m trying to maintain, but all of these options disappear when I hide the WordPress Admin Bar above:
Hello everyone!
I’ve been searching for hours on every site I can possibly think of, and I’ve looked at tons of articles in regards to the admin bar, but haven’t found any similar issues.
The website I am currently building I am using BuddyPress version 2.8.2, BuddyBoss theme version 2.3.3, and WordPress version 4.7.4.
I want to hide the WordPress admin bar from all users except the administrator. That’s simple, as I have found many different ways to do it (coding, plugins, etc).
The issue I am running into is when I hide the WordPress admin toolbar (regardless of method, ie. coding or plugin), it also removes all of the dropdown options for the BuddyPress admin toolbar (activity, profile, friends, messages, etc) that shows up with the BuddyBoss theme. I originally thought it was a coding issue in the BuddyBoss theme, but from the information I found, the admin bar that shows up with the theme comes from the BuddyPress plugin.
I imagine that the BuddyPress plugin uses the same call function (I don’t code much so I don’t know the proper term) to get it’s drop down menu as WordPress does for it’s admin toolbar. My issue is I can’t figure out where/what that is so that I can change it to something custom.
Any assistance would be greatly appreciated.
I administer two social sites and both are asking of there is any way to remove notifications of people joining the group and who made friends with whom… It is plugging up the group notification area and users are getting annoyed.
I have searched for appropriate plugins and found a few but all are depreciated and mess up the site.
Wordpress 4.7.3
Buddypress 2.8.2
Bbpress 2.5.12
I found a code hack for the functions.php but it can’t be used in the child “guideline” theme. When added to the child, I lose admin pages. code snippet below
// Remove (hide) various activities from streams.
function my_hidden_activities($a, $activities) {
//if admin we want to know
//if (is_site_admin())
// return $activities;
$nothanks = array(“new_blog_post”, “created_group”, “joined_group”, “new_member”, “friendship_created”, “activity_liked”);
foreach ($activities->activities as $key => $activity) {
if (in_array($activity->type, $nothanks, true)) {
unset($activities->activities[$key]);
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items.
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action(‘bp_has_activities’, ‘my_hidden_activities’, 10, 2 );
The author suggests adding to functions.php but without using the child theme the code would be lost after an update. It also broke the site… Even after reverting the changes, the menu and page formatting was gone.
Is there any way that is up to date to filter what activity is reported on the group wall?
Excellent solution from @livingflame
The Link: SOLUTION
Hi there,
We are building a community website using buddypress and Boss theme and I wanted to ask if you could help us hide the @username on the cover photo. Exposing the username brings up security issues especially for site admins so we want to hide it and only show the name which can be changed.
Your help will be greatly appreciated. Thank you!
Wordpress version 4.7.3
Buddypress version 2.8.1
I found an issue on a buddupress activity single post.
Step1:- UserA create an activity/post on group.
Step2:- UserB creates a replay on the UserA post.
Step3:- WP admin changes user status of UserB as spam.
Step4:- Then activity stream doesn’t display the replay that is created by the userB. But the single page of that activity/post shows the reply of spam(UserB) user post.
Please help me to solve the issue.
@sitesforchrist: To hide the admin you could use something like this: https://buddydev.com/plugins/bp-stealth-mode-for-site-admin/
@antonop4u because users can change their display name (unless you are going to institute code to lock their display name in place), using their display name in the URL will probably lead to issues if a user changes their display name, breaking existing activity URLS. In a worst case scenario a user could change their display name to match another user and cause some interesting collisions.
@johanna75 – We do need some kind of universal “display public ok” field perhaps?
Some people have fields set to ‘friends only’ – so things in search should only display to them.
Bp has a thing in it when a user is marked as spam, then they are only visible to admins – so I think this kind of functioning is half in there already.
Would be nice for the buddyblock and rtmedia plugins to also consider this visibility thing, and for buddyblock to be able to conditionally affect that as well.
I could see the need for someone to hide certain things from the public and from specific people – what a nightmare it is when things that were assumed secret pop up in search results.. I had this happen with a wp install – pages published but password protected – well either the theme, or the post teaser plugin pulled data from those non public pages and put them smack in the public search results.
Luckily the bp profile search pluing (that I also use – it’s great!) – is under active development – (I see the author has responded to the support forum on wp repo saying it is an issue that is under consideration, but bp does the same thing – so it’s no different in the privacy regard) wonder if we could ping the other bp peeps and rtmedia and buddyblock peeps tp put some heads together on this..
I have a similar problem right now with rtmedia not meshing with buddyblock. When a user blocks and enemy on my site – that enemy can not message them or comment on their activity – but they can harass the sh*t out of them via comments on their media.
Hi I agree with you. I’m also trying to find a way to hide the user name, but not only for the admin, but also for any other member. I’m the admin and hope to use a password difficult to find, but we know that many user have password quite easy to find.
I’m using the extended profile with a mandatory nickname, and I wonder if there and way to let it take the user-name place in the ulr and in the name beside the picture?
There are so many possibilities with Buddypress as it is but there many ways it can be improved. I know it’s a fact of life that we must rely on plugin developers to make our sites unique so I will focus on features already in Buddypress core that could be improved.
User management and profiles: This really should be developed further for easy user management. I understand many of these have plugin options available but adding to core would be a major improvement for managing large scale sites.
1. All user management columns should be sortable.
2. IP address and country should be built in without a plugin.
3. Add User ID to admin column.
4. Add ability to moderate with suspend and ban with a period of time and notice.
5. Add ability to core to easily change member types.
6. Add last login to core
7. Add ability for members to block other members.
8. Add ability to hide profile.
9. Add ability to block domains from signing up.
10. Add more privacy settings allowing members to control all aspects of their content.
Notifications:
1. Add instant notifications.
2. Send email on notifications to increase site engagement.
3. Add user thumbnail image along with notification.
4. Show day or date on the notification.
I realize many of these can be accomplished with plugins but some of these really need to be built in core to improve performance and security.
Random suggestions would be to add more basic features similar to Facebook and Twitter and bring Buddypress up as the go to social network builder. Mentions, search, favorites, likes, autocomplete are in need of an update to be modern.
It’s my opinion not fact. 🙂
Hi there!
I have this code —-> But this code does not work anymore with BuddyPress 2.8
// Hide admin's activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// ... but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID's to exclude, separated by commas. ID 1 is always the superadmin
if ( $activity->user_id == 1 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
And, I have other code, but this only hide admin from Directories and Bp Widgets.
// 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
if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return $args;
}
$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;
}
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’);
Hi there,
Is there a plugin that anyone knows or a coding way that I would be able to display the buddypress activity feed which be able to update itself? I mean, now when someone at my website do action like update a post, the activity feed record this action, but if this user change the topic / date of this post or even if the user change his profile name / image – the activity feed still display the old record.
I understand how it works like record the activity to a place to the DB and just print it, but does someone knows another different way to display a real time feed that updates the old feed?
Also I need the activity feed to be flexible:
display blog posts, buddypress activity, bbpress activity,
admin customize like edit activity, delete, hide activity metas and filter.
Please help.
Thanks in advanced.
Hi Paul
You’ve been a great help!
I managed to find the correct buddypress index file.
If it isn’t too much I would like your help to one last thing.
So i created my div, however i want it to be visible to only the administrator.
I found a code i can use:
<?php
if (current_user_can(‘edit_users’)){
?>
<div class="opretbruger">Opret bruger</div>
<?php
}
?>
however it doesn’t seem to work – it simply hides the div for every user even though my administrator role has the right to edit users. I also tried with ‘administrator’. Am i doing anything wrong?
Thanks for the quick response, but doesn’t seem to be working for me. I created the template overload of profile-loop.php and stored it in wp-content/themes/buddyboss-child/buddypress/bp-templates/bp-legacy/buddypress/members/single/profile. I’ve pasted the entire file below after modification.
I can’t find it now, but there was a thread somewhere that indicated that the following line needed to be changed in bp-xprofile-template.php so was wondering what you thought of that.
$hide_empty_fields_default = ( ! is_network_admin() && ! is_admin() && ! bp_is_user_profile_edit() && ! bp_is_register_page() );
Anyway, here’s my profile-loop.php:
`
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’);
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.
In short I need this code to redirect to 404 page not homepage. Thank you.
// deny access to admins profile. User is redirected to the homepage
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 );
Hello
I’m looking for a way to hide the list of subscribers in a group.
I can explain: a subscriber of group “A” can not see the other subscribers of group “A”, only the administrators of the group can see them.
I found the solution:
// 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
if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return $args;
}
$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;
}
// Deny access to admins profile. User is redirected to the homepage
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 );
// Hide admin's activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// ... but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID's to exclude, separated by commas. ID 1 is always the superadmin
if ( $activity->user_id == 1 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
Solution: HIDE ADMIN FROM BP WIDGETS AND DIRECTORY
This code is complementary for the other ==>
Hiding Users on BuddyPress based site
So, full code:
// Exclude Admin 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
if( is_admin() && ! defined( 'DOING_AJAX' ) ) {
return $args;
}
$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;
}
// Deny access to admins profile. User is redirected to the homepage
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 );
// Hide admin's activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// ... but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID's to exclude, separated by commas. ID 1 is always the superadmin
if ( $activity->user_id == 1 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
@danbp
Hi!
Can you help me?
How I can hide super admin’s vcard from BuddyPress Widgets??
Your code only hide super admin from members and activity…
// Deny access to admins profile. User is redirected to the homepage
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 );
// Hide admin’s activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// … but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID’s to exclude, separated by commas. ID 1 is always the superadmin
if ( $activity->user_id == 1 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( ‘bp_has_activities’, ‘bpfr_hide_admin_activity’, 10, 2 );
// 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’);
@henrywright
This work okey –>: but, How I can Hide Admin from BuddyPress Widget??
—->
// Deny access to admins profile. User is redirected to the homepage
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 );
// Hide admin's activities from all activity feeds
function bpfr_hide_admin_activity( $a, $activities ) {
// ... but allow admin to see his activities!
if ( is_site_admin() )
return $activities;
foreach ( $activities->activities as $key => $activity ) {
// ID's to exclude, separated by commas. ID 1 is always the superadmin
if ( $activity->user_id == 1 ) {
unset( $activities->activities[$key] );
$activities->activity_count = $activities->activity_count-1;
$activities->total_activity_count = $activities->total_activity_count-1;
$activities->pag_num = $activities->pag_num -1;
}
}
// Renumber the array keys to account for missing items
$activities_new = array_values( $activities->activities );
$activities->activities = $activities_new;
return $activities;
}
add_action( 'bp_has_activities', 'bpfr_hide_admin_activity', 10, 2 );
// 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');
https://wordpress.org/plugins/admin-tools/
This one claims to be able to hide parts of the admin bar
For points 1 and 2 you need to ask at the BuddyDev forums as they are not BP issues.
For point 3 you can edit BuddyPress emails in Dashboard>>Emails.
For point 4 there’s some plugins that will hide the admin bar for certain user types, I’ve not tried them but try searching the WordPress plugin repository one I saw that might do the trick is https://wordpress.org/plugins/better-admin-bar/