Hi there,
I´ve added the code in the functions.php of my child-theme.
In the “Who´s online”-widget, I still see the super admins. Any ideas to hide them in the widget?
Thank you!
Cheers
Marco
@merosler
If your adding php code I hope you have made a child theme as @philipstancil did because that is the proper way. I would never add custom code to a parent theme’s functions.php because if you update the theme then it may get overwritten. Anyway, make sure whenever you add code to functions.php it always needs to be between opening and closing php tags like this:
<?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;
}
?>
@aces
Yes! Thank you, it works. 😀
@ishanna
Could your problem be a copy/paste error?
You appear to be using ‘ and ’ – they should all be '
Hallo @sbrajesh !
I tried use code:
add_action(‘bp_friends_setup_nav’,'bpdev_custom_hide_friends_if_not_self’);
function bpdev_custom_hide_friends_if_not_self(){
if(bp_is_my_profile()|| is_super_admin())
return ;
bp_core_remove_nav_item(‘friends’);
}
I copied and pasted the code into the ‘bp_custom.php’ file but it did not work for me.
I’m new to wordpress, html, php and css but I seem to find my way til now. Some advise please? I really need this option to work and I can’t find a plugin that cover this.
Kind regards,
Crazy that we both found this old thread within 12 hours of each other. I got it working with this code:
// 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;
}
Hi,
I’m using the latest BP release – 1.9 and the latest WP 3.5.2.
I’ve searched everywhere on how i can re create the top right BP admin bar that shows the user profile pic and loads of really useful links?
My set up is as follows ..
I have BP templates added to a ‘buddypress’ folder in my theme. I have the buddypress-functions.php in my theme and i have tried to use bp-custom in the root of my plugins folder.
My problem is that all the documentation seems to be quite old now and the likes of
define(‘BP_DISABLE_ADMIN_BAR’, TRUE);
doesn’t seem to do anything anywhere i put it? I thought this might hide the top right bp profile but it doesn’t? I wanted to hide it as i was following a few users posts about hiding it first before adding it somewhere else?
Literally nothing is working for me?
Can anyone help me on how to
1) Hide the top right BP profile bar
2) Leave the WP admin bar as usual
3) Output the BP profile bar somewhere else on my theme – ie somewhere lowerdown or even in my navigation?
Thanks for any help in advance!
In the latest BuddyPress – 1.9 – i want to hide the admin bar but keep it for WP site users (editors, admins) that aren’t BP users? Is that possible?
As a hack I can hide them using css by adding this to my functions.php file:
function hide_group_admin_tabs($classes) {
$user_id = bp_loggedin_user_id();
$group_id = bp_get_current_group_id();
if ( bp_is_groups_component() ) {
if ( groups_is_user_admin($user_id, $group_id) ) {
$classes[] = 'group-member-admin-cap';
} else if ( groups_is_user_mod($user_id, $group_id) ) {
$classes[] = 'group-member-mod-cap';
}
}
return $classes;
}
add_filter( 'body_class', 'hide_group_admin_tabs', 98 );
And then adding display:none; rules to the tabs. But I would like to handle the navigation the right way (and not with a css hack). Any ideas?
Thanks for your help,
-David
Hi,
A BP plugin Members Avatar Map needs to have a field “Latitude and Longitude” set. I would like to hide it from users and visitors. Is there a way to make that field visible ONLY to the administrator (not even the user whom it concerns)?
I have set the visibility option to “Admin Only” but it is still visible to everyone.
BP v. 1.8
Thanks for your help.
@bphelp. I think I have discovered the culprit to this little mystery.. I have been using the Buddypress Members Import plugin: http://www.youngtechleads.com/buddypress-members-import/
For some reason when I import my database, the plugin does not seem to process the xProfile Field visibility settings properly.. The profile fields are still listed as “Admins Only” But for some reason they are still visible to all users.
Earlier, I manually added some new test profile fields and they worked fine. I also discovered, that if I edit, and re-save a user’s profile field after import, all profile fields for that user will then revert to the proper visibility settings.
I have contacted the plugin author to make him aware of the issue, hopefully he can fix it. If you have any suggestions that might be a quick fix for this I’m all ears! 🙂
@bphelp. Upon a little further research, I wanted to note that I created a new User Profile Group, created a private field seen by Admins Only in that group, and the settings seem to be working fine in that group. In my Base (Primary) group though, all profile fields still remain visible to all users. Does the Base (Primary) group automatically force all fields visibility public by default? If so, is there way to override?
If there is no way to change the visibility in the Base (Primary), I suppose I can just put private info in the other Profile Group, but I’m curious if or how that may effect my database import..
Hi,
I’m confused.. I have my Base/Primary Profile Fields set up. I have set some fields visibility to “Admins Only”, but when I log in as a subscriber user, all user profile fields are still visible to me. Am I misunderstanding this function, or is something not working right?
Either way, I’m looking for a solution to hide certain extended profile fields from users, so that they are visible only to admins.. I’ve been looking through the forums, it seems like there have been similar requests, but I am unsure whether or not there is a clear cut solution to this.
Any ideas why this might be happening or how to accomplish what I’m trying to do?
Hello,
I got one question, I integrated S2 member plugin with buddypress, but I got one problem. I have different types of membership levels (example: level 1, level 2, level 3), when I make post from admin account or another account that I created (editor) every membership level see that post in activity, even level subscribers which are not paid level. If I hide Activity page in general, then they can go on author’s profile and see activity there. If I disable Activity component then it is disabled everywhere even in private groups for that level 1, 2, 3 members.
So is there way to not show activity from certain account from which I am making posts that only one level should see.
If I make post for level 2 members for example, then membership levels 2 and 3 should see it.
If I make post for members on level 3, then only members of level 3 should see it on activity stream.
If I make post for members on level 1, then members from level 2 and 3 need to see it also.
Does anyone know how that make that without disabling activity stream component. It would be the best just not to show posts on activity stream from that account that I am making posts, if it is possible to make that.
Making a url restriction in s2 members doesn’t make sense.
Thank You and Best regards
While very doable, this will require custom coding.
You can contact me at PhiloPress
WP Version: 3.5.1
BuddyPress: 1.7.2
You want to ‘hide’ the profile page for a member who hasn’t paid their dues?
What should happen if that page is accessed by that member or another member?
Redirect? Custom message page ?
Either redirect to a listing of all active members or display an error page would be fine, (i.e. “This member is not currently an active member.”)
If ‘paid dues’ is a boolean, then it’s easy to write a function.
Where is that boolean stored?
It would be stored in their profile as an Admin-editable field, per the original post.
Does that member still appear on the Members page? In the Activity stream?
No to both. Hidden users would be able to login and update information but their profile wouldn’t be public-facing, just them and the admins.
This would be useful as we have staggered dues, allowing profiles to turn off/on.
You need to state which versions of WP & BP you use.
You want to ‘hide’ the profile page for a member who hasn’t paid their dues?
What should happen if that page is accessed by that member or another member?
Redirect? Custom message page ?
If ‘paid dues’ is a boolean, then it’s easy to write a function.
Where is that boolean stored?
Does that member still appear on the Members page? In the Activity stream?
iow. you need to be more specific about the behaviour that you want.
You can download a plugin like Theme My Login — it automatically redirects logged out/non-registered users to a log-in page with your site’s style.
I don’t want registered or non-registered users to got to http://www.abc.com/wp-admin
I want them to be redirected to profile page.
Issue
I work with trade associations and we want a simple way of hiding profile displays for members’ whose dues aren’t paid.
We’re hoping not to run through a third party plugin. This is both to cut costs and to limit complexity for our volunteer-led organization. (handling multiple plugins will make the site less easy for the non-technical volunteers to maintain).
Questions
- Is there plugin to hide a profile based on an Admin-field value?
- (i.e. “Paid Dues?” with a boolean value like 0 or 1)
- If not, is there an easy way to prevent a profile from displaying through scripting?
*My theme also… haha sorry for bad grammar
Hey,
If you go to Dashboard Settings > Buddypress > Settings, then the first option is ‘Show the Toolbar for logged out users’. Just uncheck it.
My theme is also has a setting for the login toolbar, so you may want to check out your theme settings.
I hope it helps!
Hi,
I want to disable or hide the BP Admin Bar for Logged Out Users. Unless you log in the BP Admin BAr should not be visible.
Please Help.