Search Results for 'hide admin in directory'
-
Search Results
-
Hey guys,
Would anyone know how to hide and disable member pages based on their role type. (e.g. yoursite.com/members/username)
Goal: if a member is set to a WordPress Administrator role, we would like to make his/her page inaccessible from the public
Purpose: while we have been able to hide specific roles from displaying in the member directory, their member/page is still visible if you know the URL.
Similar to how we can make the WordPress Author page inaccessible, we’d like to do the same for BuddyPress’s equivalent Member page.
Thanks in advance
Hey guys,
Wondering if there is a way to hide specific members based on a extended profile setting.
While I see options for hiding based on WordPress user role (i.e. Admin, Author, etc.) or based on WordPress user’s ID #, I’m hoping we can do this via an option available to admins to change whether a member is visible in the directory.
Also, we found that the options to hide users appear to work on the parent Buddypress but those settings don’t affect the child site in a multiblog/multisite setting.
Any suggestions is greatly appreciated thanks!
Hi all,
I’m new to buddypress and have no experience with php. I have how ever managed to follow instructions on previous posts on preventing users from seeing the admin profile and activity but it hasnt worked correctly and has come up with errors.
I managed to create the bp-custom.php in the wp-content/plugins directory but the admin profile still appears and just comes up with an error message saying fatal error. It still allows the option to add as a friend aswell unless that might be to do with viewing it from an account already adding the admin account with.
This is where I got the code Im using from:
https://buddypress.org/support/topic/hide-admin-from-members-and-activity/Code in the bpcustom file
<?php 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 ); 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'); 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 ); ?>Hi, I’m using Buddypress Version 2.5.3 and WordPress 4.5.2.
I’m running a multisite wordpress installation, Right now I’m trying to exclude the suscribers in the members directory, this is the code i found:
function bpdev_exclude_users($qs=false,$object=false){ //list of users to exclude if($object!='members')//hide for members only return $qs; $excluded_user = implode(',',get_users('role=subscriber&fields=ID')); $excluded_admins = implode(',',get_users('role=administrator&fields=ID')); //$excluded_self=bp_loggedin_user_id(); $args=wp_parse_args($qs); //check if we are searching for friends list etc?, do not exclude in this case if(!empty($args['user_id'])) return $qs; if(!empty($args['exclude'])){ $args['exclude']=$args['exclude'].','.$excluded_user; $args['exclude']=$args['exclude'].','.$excluded_admins; //$args['exclude']=$args['exclude'].','.$excluded_self; } else { $args['exclude']=$excluded_user; if(!empty($args['exclude'])) $args['exclude']= $args['exclude'].','.$excluded_admins; else $args['exclude']=$excluded_admins; //$args['exclude']=$excluded_self; } $qs=build_query($args); return $qs; } add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);but right now, the get_users function won’t show any subscriber because there are not suscribers on this site, but on the other ones. Anyway, the buddypress is showing all users including the ones in the other sites.
any hint?
Thanks
I am trying to hide the currently logged in members as well as admins from the members directory/search results. I’m using the following code, but everything I try and hide the currently logged in user (
$excluded_self=bp_loggedin_user_id();), the admins reappear; commenting out the aforementioned line hides the admins. Does anyone know why that is and how to fix it?//hide all subscribers and admins from search results area add_action('bp_ajax_querystring','bpdev_exclude_users',20,2); function bpdev_exclude_users($qs=false,$object=false){ //list of users to exclude if($object!='members')//hide for members only return $qs; $excluded_user = implode(',',get_users('role=subscriber&fields=ID')); $excluded_admins = implode(',',get_users('role=administrator&fields=ID')); //$excluded_self=bp_loggedin_user_id(); $args=wp_parse_args($qs); //check if we are searching for friends list etc?, do not exclude in this case if(!empty($args['user_id'])) return $qs; if(!empty($args['exclude'])){ $args['exclude']=$args['exclude'].','.$excluded_user; $args['exclude']=$args['exclude'].','.$excluded_admins; //$args['exclude']=$args['exclude'].','.$excluded_self; } else { $args['exclude']=$excluded_user; $args['exclude']=$excluded_admins; //$args['exclude']=$excluded_self; } $qs=build_query($args); return $qs; }A different issue: the number of resulting members returned when a user searches still includes admins/removed users&roles. Is there a way to fix the results count to exclude those? Can I modify the code below for that?
function bpfr_hide_get_total_filter($count){ return $count-1; } add_filter('bp_get_total_member_count','bpfr_hide_get_total_filter');Hi Everyone,
Please, I have been trying for a while now to hide all admin accounts on my site from all activities, member directory and the profile. I followed the suggestion on this thread https://buddypress.org/support/topic/hide-admin-from-members-and-activity/ which worked but for one admin(the first admin account on the site), other admin accounts are still accessible. What could be a solution to this please?
1. Which version of WordPress are you running?
4.3.1
2. Did you install WordPress as a directory or subdomain install?
root directory
3. If a directory install, is it in root or in a subdirectory?
root
4. Did you upgrade from a previous version of WordPress? If so, from which version?
4.3
5. Was WordPress functioning properly before installing/upgrading BuddyPress (BP)? e.g. permalinks, creating a new post, commenting.
yes
6. Which version of BP are you running?
2.3.3 (also with 2.5.8 bbpress)
7. Did you upgraded from a previous version of BP? If so, from which version?
no
8. Do you have any plugins other than BuddyPress installed and activated? If so, which ones?
yes
AG Custom Admin
All In One WP Security
bbPress
bbPress Multi Image Uploader
bbPress Notices
BuddyPress
BuddyPress Forum Editor
Bug Library
Coming soon and Maintenance mode WpDevArt
Content Aware Sidebars
GD bbPress Tools
Merge + Minify + Refresh
Redis Object Cache (currently deactivated and troubleshooting)
Remove Dashboard Access
rtMedia for WordPress, BuddyPress and bbPress
Scrollbar Designer
Steam News Widget
WP Change Default From Email
WP Clone by WP Academy
WP Super Cache
WP ULike
WPS Hide Login9. Are you using the standard WordPress theme or customized theme?
child of Spacious from themegrill
10. Have you modified the core files in any way?
a couple small tweaks in child theme
11. Do you have any custom functions in bp-custom.php?
not that i am aware of
12. If running bbPress, which version? Or did your BuddyPress install come with a copy of bbPress built-in?
yes, 2.5.8
13. Please provide a list of any errors in your server’s log files.
[Wed Sep 16 11:20:01.065681 2015] [fcgid:warn] [pid 19091] [client my.ip.address:1024] mod_fcgid: stderr: PHP Notice: Undefined offset: 0 in /home/mysite/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/functions.php on line 133, referer: http://mysite.com/groups/united-division/forum/ [Wed Sep 16 11:20:01.065720 2015] [fcgid:warn] [pid 19091] [client my.ip.address:1024] mod_fcgid: stderr: PHP Notice: Trying to get property of non-object in /home/mysite/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/functions.php on line 133, referer: http://mysite.com/groups/united-division/forum/14. Which company provides your hosting?
Self hosted Debian Jessie with virtualmin
15. Is your server running Windows, or if Linux; Apache, nginx or something else?
Debian Jessie
I have debugging on and when I go to a locked thread in a group forum (open or private so far), the same error is displayed on top as part of wp debug
[16-Sep-2015 18:21:55 UTC] PHP Notice: Undefined offset: 0 in /home/mysite/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/functions.php on line 133 [16-Sep-2015 18:21:55 UTC] PHP Notice: Trying to get property of non-object in /home/mysite/public_html/wp-content/plugins/bbpress/includes/extend/buddypress/functions.php on line 133My site is currently locked down for beta testers. I could give you the address in private but I would need your IP address to whitelist you.
I’ve been getting weird errors when trying to log an activity item via
bp_activity_add():WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '( user_id, component, type, action, content, primary_link, date_recorded, item_i' at line 1 for query INSERT INTO ( user_id, component, type, action, content, primary_link, date_recorded, item_id, secondary_item_id, hide_sitewide, is_spam ) VALUES ( 3163, 'members', 'new_member', '', '', '', '2015-07-16 15:47:00', 0, 0, 0, 0 ) made by require('wp-blog-header. php'), require_once('wp-load.php'), require_once('/srv/www/commons/current/web/wp-config. php'), require_once('wp-settings.php'), include('/themes/tuileries/functions.php'), bp_activity_add, BP_Activity_Activity->saveAs you can see, there’s no table name here. It should be
INSERT INTO wp_bp_activities...or thereabouts. It looks likeBP_Activity_Activity->save()is trying to access$bp->activity->table_name, but$bp->activitydoesn’t have atable_nameproperty at this stage. Instead, this is all that is in$bp->activity:BP_Activity_Component Object ( [name] => Activity Streams [id] => activity [slug] => [has_directory] => [path] => /srv/www/commons/current/web/app/plugins/buddypress/ [query] => [current_id] => [notification_callback] => [admin_menu] => [search_string] => [root_slug] => [meta_tables] => Array ( ) [global_tables] => Array ( ) [adminbar_myaccount_order] => 10 )Why isn’t there a table name here? How can I fix this?
Im using great codes provided here for admin to be hidden from all members directory, but admin still shows up in groups members list and they can try and add him/here as a friend which is not what many people want.
I’m trying to remove the admin user and other users of the membership list. But all the solutions researched here in the forum have not worked.
I was wondering if it was because of the recent update of WordPress.Does anyone have any solution to help?
thank youHi,
I am really struggling with trying to hide my admins from my site. I searched this site and tried every code available with no success. Below is the last code I tried with no success.
https://buddypress.org/support/topic/hide-admins-activities-from-all-activity-feeds-in-buddypress/
Any ideas what I am doing incorrectly? This code is inserted in my child themes fuction.php correct?I am racking my brain on this one!
Thanks for any help,
KenThe Theme I am using is KLEO by Seventh Queen
Buddy Press version Version 2.2.1
Website:http://www.cmpg-annex.org/Other Plugins
Akismet
bbPress
BuddyPress Cover Photo
K Elements
MOJO Marketplace
Paid Memberships Pro
PMPro MailChimp Integration
PMPro Register Helper
PMPro Set Expiration Dates
Register Helper Example
Revolution Slider
rtMedia Pro for WordPress, BuddyPress and bbPress
The Events Calendar
WPBakery Visual Composer// 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 ); // 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'); // 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 );