Search Results for 'Hide Admin'
-
AuthorSearch Results
-
February 23, 2017 at 11:45 am #264083
In 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.
October 9, 2016 at 7:41 pm #259656In reply to: Admin bar icons do not display on some devices
giuseppecuttone
ParticipantI will be your savior,
for same rasons, wordpress decided not show admin bar like default in mobile.
It is so,maybe, because when user log in in mobile device, a lot of menu will be showed… really I dont know why…
But if you dont have this problem, and want show admin bar for log in an log out users, you must add in CSS the following codec:@media screen and (max-width:782px) { #wpadminbar { display:block; } html { position:absolute; top:-46px; } }The codec where say html position absolute is for delete noise black bar located in the up side zone.
If you want, you can also show the notification icon (I think it is named budlle notification) into the admin mar, adding the following codec in CSS zone:/* Show only default top level items */ #wp-toolbar > ul > li { display: block; }I have gone mad to find the solution, but now we have it.
If you dont want show menu in admin bar to the suscriptors, colaborator and authors, you can use the AG CUSTOM ADMIN plugin. It hide them and help you in a clean design. (you can also hide wordpress logo, and so much things…)Now, I have only a litlle / big problem:
the drop down menu, when I click in the “notification icon” in the admin bar, is not showed correctly… It is showed from the “notification icon” to the right zone, so in mobiles user can red the title of the notification.
The solution is show the dropdown menu from the “notification icon” to the left zone. So, also in mobiles users can red the title of the notification.
Can you help me for to make that?
I have helped you, now I hope someone can help me 😉
Thank for your support and have funnyOctober 1, 2016 at 3:16 am #259293In reply to: securing admin login user name
ckchaudhary
ParticipantHi Earl,
Two things you can do:- Hide admin user from members list. This post has some answers:- https://buddypress.org/support/topic/hide-admin-from-members-and-activity/
- Change the user_nicename field in users table in database, for the admin user.
I suggest going with the first option.
September 19, 2016 at 5:37 pm #258920Brajesh Singh
ParticipantPlease put this code in your 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' );That should do it. Hoe it helps.
September 18, 2016 at 8:29 pm #258900danbp
ParticipantHere “the best guarded secret” finally revealed !
But it’s not a secret, is part of Codex and a multi handled topic subject on this forum.What we want to do: remove access possibility.
Where: on BuddyBar navigation menu (the one below the profile header).
Specifics: make the activity and forum tabs only visible to the logged in user.NOTE: The activity tab is shown by default when you visit a profile.
As we are going to hide/remove this tab to visitors, we need to define as first another default tab. If we won’t do that, the visitor will get a Page not found error. Which is not exactly the case here, the page exist but the visitor can’t access it.
Let’s define arbitrary Profile as the new default tab. You can of course define what ever other existing tab on your BuddyBar as default.
Add this line to bp-custom.php
define( 'BP_DEFAULT_COMPONENT','profile' );Now the mega “open secret” !
The folowing snippet contains almost any BP menu items you can have on a BuddyBar, and includes also the Forum item, in case you use bbPress.
You can remove or comment out those you don’t want to use.
Note also that it is only an example – you have to play with it to fit your need. But at least you have the right syntax to use.
Note also that some profile menu items are user only, such as message or notice. In other words, these are always private.This function goes preferably to bp-custom.php
function bpfr_hide_tabs() { global $bp; /** * class_exists() & bp_is_active are recommanded to avoid problems during updates * or when Component is deactivated */ if( class_exists( 'bbPress' ) || bp_is_active ( 'groups' ) ) : /** here we fix the conditions. * Are we on a profile page ? | is user site admin ? | is user logged in ? */ if ( bp_is_user() && !is_super_admin() && !is_user_logged_in() ) { /* and here we remove our stuff ! */ bp_core_remove_nav_item( 'activity' ); bp_core_remove_nav_item( 'friends' ); bp_core_remove_nav_item( 'groups' ); bp_core_remove_nav_item( 'forums' ); } endif; } add_action( 'bp_setup_nav', 'bpfr_hide_tabs', 15 );Some other hints for privacy
if you want to allow only the profile owner to view some tabs, replace
!is_user_logged_inby!bp_is_my_profile()– this scenario doesn’t need a check for logged in users as it is made bybp_is_my_profile.If you want only to make a profile private, read here.
If you want to remove a sub-nav item (ie. View on Profile), you use something like:
bp_core_remove_subnav_item( 'profile', 'view' );Many other possibilities for navigation are also available, including for groups. Several examples are given on Codex, here.
And if not enough, RTFM and search the forum ! 🙂
Have fun !
-
AuthorSearch Results