Search Results for 'Hide Admin'
-
AuthorSearch Results
-
April 25, 2017 at 2:03 am #265600
zsauce
ParticipantThis 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:
March 28, 2017 at 6:25 am #265038In reply to: [Resolved] Hide Admin from Members and Activity
WPisGOOD
ParticipantExcellent solution from @livingflame
The Link: SOLUTION
February 25, 2017 at 2:12 am #264150In reply to: Admin Username in Members URL
mrjarbenne
Participant@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.February 24, 2017 at 7:49 am #264118In reply to: hide members from search results
djsteveb
Participant@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.
February 23, 2017 at 11:45 am #264083In reply to: Admin Username in Members URL
antonop4u
ParticipantHi 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?February 15, 2017 at 3:38 am #263784In reply to: Hide members
beforeplastic
ParticipantThank 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’);February 6, 2017 at 4:45 pm #263567In reply to: Adding a link (button) on member directory page
djmazi12
ParticipantHi 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?
February 1, 2017 at 1:07 am #263397In reply to: Don’t hide fields when user views his own profile
john.horning
ParticipantThanks 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:
`January 24, 2017 at 7:00 pm #263153In reply to: Hide members
beforeplastic
ParticipantI 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’);January 24, 2017 at 6:48 pm #263152In reply to: Hide members
beforeplastic
ParticipantPS. 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.
January 16, 2017 at 8:56 am #262840In reply to: [Resolved] Hide Admin from Members and Activity
EMRETHEAVIATOR
ParticipantIn 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 );December 27, 2016 at 11:11 pm #262412In reply to: [Resolved] Hide Admin(s) from Bp Widget
livingflame
ParticipantI 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 );December 27, 2016 at 10:48 pm #262411In reply to: [Resolved] How to Hide Admin accounts 2016?
livingflame
ParticipantSolution: HIDE ADMIN FROM BP WIDGETS AND DIRECTORY
This code is complementary for the other ==>
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 );December 9, 2016 at 12:39 am #261914In reply to: [Resolved] How to Hide Admin accounts 2016?
livingflame
ParticipantThis 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');Venutius
Moderatorhttps://wordpress.org/plugins/admin-tools/
This one claims to be able to hide parts of the admin bar
Venutius
ModeratorFor 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/
November 15, 2016 at 10:08 am #261018In reply to: Group header file problems
jaumearagay
ParticipantI have:
a.- Updated to BP 2.7.2. <– Still same problems but warnings hidden by my code.
b.- Removed the buddypress folder in my theme with edited files and checked. <– Still same problems: Warnings (as my code did not hide them), “Moderators” tag and “no mods” string.
c.- Downloaded and activated Twenty Sixteen theme. <– Same as in previous step.
And I get the same warning explained in the first entry in this post so it’s not about my modified files and it’s not about a theme problem.
There are still two problems:
1.- The warning points to get_group_moderator_ids( $group_id ) in /wp-content/plugins/buddypress/bp-groups/classes/class-bp-groups-member.php
I don’t have (or have had) moderators in any group so, “Creating default object from empty value” <– What default object from what empty value?
2.- The problem is somewhere else: In line 33 of the group-header.php file (in groups/single/ ) we find this line:
if ( bp_group_has_moderators() ) :where “bp_group_has_moderators()” is giving a false “true” value as I don’t have moderators in any group so it should not execute in the first place. And after the Moderators tag it says “no mods”, so it on a later step recognizes there are no moderators!!!
Has the bp_group_has_moderators() function or get_group_moderator_ids( $group_id ) function been altered? Or the data about mods and/or admins in the groups?
Because one of them creates two warnings (one before listing the admins and one before listing the mods) that were not there before and also shows a “Moderators” tag that did not appear as the
if ( bp_group_has_moderators() )returned the FALSE value my no-mods groups “deserve” (which it later recognizes when adding the “no mods” string) that now returns this “buggy” TRUE value and shows the tag.November 10, 2016 at 6:14 am #260892Topic: help with default activity stream tab
in forum How-to & TroubleshootingMasoud
Participanthi.
i am using latest versions of both wordpress and buddypress.and working on a food website.
in this website , i wanted to allow only authors to post activity updates .
(because it will be much easier for users to track their favorite chef recipes in the activity page.)
so i’ve hide the ” personal ” submenu of activity tab : Activity > Personal (where people can post updates)
with the help of following code in bp-custom.php :function bpfr_hide_tabs() { global $bp; if ( bp_is_user() && ( !current_user_can(author) || !current_user_can(administrator) ) ) { bp_core_remove_subnav_item($bp->activity->slug, 'just-me'); } } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );but now when i go to my profile (as a subscriber)
i will see a 404 page.
i’ve searched a lot and i noticed that , now that i’ve removed the default activity stream tab , i have to point it to another tab. so when a user profile is loading (or if a user clicks on activity tab),
instead of default activity> personal . it load activity > mentions / OR / favorites / OR / … (some other submenu than personal )so my question is:
how can i change the default activity stream tab
from
Activity > Personal
To
Activity > Mentions – Or to – Activity > Favorites – …thanks a lot for any help.
October 30, 2016 at 11:34 pm #260568In reply to: [Resolved] show buddypress private message button
danbp
Participanthi @masoud1111,
all i found was how to hide that button, or remove it.
but not show it only on some profilesYou just need to add some conditionnals.
Try this (in bp-custom.php) and give feed back if it works.
function bpex_private_message_button( $button ) { $user = bp_loggedin_user_id(); if ( is_super_admin() ) { return $button; } if ( !empty( $user->roles ) && is_array( $user->roles ) ) { if ( $role == 'subscriber' || $role == 'contributor' || $role == 'author' || $role == 'editor' ) { // hide button for these roles $button = ''; } } // allow the button to appear on admin's profile only if ( bp_is_active( 'xprofile' ) && bp_is_user() ) { $user_id = bp_displayed_user_id(); // assuming admin's ID is 1 if ( $user_id == 1 ) { return $button; } } } add_filter( 'bp_get_send_message_button', 'bpex_private_message_button', 1 , 1 );October 26, 2016 at 4:27 pm #260398ico33
ParticipantNothing to do!
Error:
Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 3
This is the bp-custom code:
<? php
function buddydev_hide_members_directory_from_all_except_admin() {
if ( bp_is_members_directory() && ! is_super_admin() ) {
//should we add a message too?
//bp_core_add_message( ‘Private page.’, ‘error’ );
bp_core_redirect( site_url(‘/’) );
}
}
add_action( ‘bp_template_redirect’, ‘buddydev_hide_members_directory_from_all_except_admin’ );October 26, 2016 at 12:26 pm #260381danbp
ParticipantThe function is working correctly on my install.
Perhaps you have an issue with quotes, ie after copy/pasting the snippet from a topic where the code whas inserted without using the code button.
Which software do you use to publish bp-custom ?Copy/paste following and give a try:
function buddydev_hide_members_directory_from_all_except_admin() { if ( bp_is_members_directory() && ! is_super_admin() ) { //should we add a message too? //bp_core_add_message( 'Private page.', 'error' ); bp_core_redirect( site_url('/') ); } } add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );October 26, 2016 at 9:55 am #260371ico33
ParticipantThanks! I did it with your suggest, so the file is
<? php function buddydev_hide_members_directory_from_all_except_admin() { if ( bp_is_members_directory() && ! is_super_admin() ) { //should we add a message too? //bp_core_add_message( 'Private page.', 'error' ); bp_core_redirect( site_url('/') ); } } add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' );
But every page of the website is now again a blank page with this error:Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 2
October 26, 2016 at 7:41 am #260364ico33
ParticipantHello and thanks for the support, I tried the solution suggested, but after I created and then uploaded the file bp-custom in the plugins folder I got an error in every page of the website:
Parse error: syntax error, unexpected ‘function’ (T_FUNCTION) in /home/mondolap/public_html/wp-content/plugins/bp-custom.php on line 2
This is my file bp-custom:
<? php function buddydev_hide_members_directory_from_all_except_admin() { if ( bp_is_members_directory() && ! is_super_admin() ) { //should we add a message too? //bp_core_add_message( 'Private page.', 'error' ); bp_core_redirect( site_url('/') ); } } add_action( 'bp_template_redirect', 'buddydev_hide_members_directory_from_all_except_admin' ); ?>October 25, 2016 at 9:38 am #260277In reply to: Hide xProfile fields from EDIT
danbp
ParticipantIt relate to this filter bp_get_profile_field_data
This example will hide tabs and fields to all except admin
function bpfr_hide_profile_field_group( $retval ) { if ( bp_is_active( 'xprofile' ) ) : // hide profile group/field to all except admin if ( !is_super_admin() ) { //exlude fields, separated by comma $retval['exclude_fields'] = '1'; //exlude groups, separated by comma $retval['exclude_groups'] = '3'; } return $retval; endif; } add_filter( 'bp_after_has_profile_parse_args', 'bpfr_hide_profile_field_group' );These tricks hide the tab content, not the tab itself. (it seems that it doesn’t work for groups at the moment…i asked devs for information) Use CSS display:none to hide the tab or consider this plugin.
October 21, 2016 at 11:03 am #260140In reply to: Hide the whole Base profile field group
bid9jafd
ParticipantThanks again.
I’d missed the second example, but, unfortunately, it doesn’t solve the issue.
If not enough, you use
CSS display:none;for the BASE markup on profile edit tab.I attempted to do this but I’m unable to target the BASE group without also affecting the USER INFO group
I noticed, too, that the “hide fields or field group to members, but not to site admin” code was preventing user registrations from going through, for some reason. It was quickly redirecting users to the home page, rather than a success or failure message page, when they clicked on the “complete sign up” button.
I think what I’ll have to do is put all fields in the BASE group & go with what @shanebp suggested in the thread I linked in my first post. & hope that potential subscribers aren’t put off by the registration form.
-
AuthorSearch Results

