Search Results for 'hide admin in directory'
-
Search Results
-
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 133
My 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->save
As 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->activity
doesn’t have atable_name
property 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 );
My wordpress is 4.1 and Buddypress 2.1.1
Hello Community,
I am having a problem with a custom member page pagination, when clicking link to pagination page 2, pagination takes us to page 2 and adds the string “?upage=2” to the site URL.
After that, clicking page 1 or back symbol on pagination links does nothing, only refreshes page.
Problematic page: http://wp1.kodeserver.net/coach/
I have set the page above in Twentyfifteen theme as to exclude any third party theme related errors.If we use the default member page “http://wp1.kodeserver.net/members/” then pagination works ok.
I believe the error might be caused by the member filter i made or maybe i messed up the template.
Hope you can help.
Below is the code i am using:
functions that i use to filter member loop by member types on the site:
function bp_exclude_users_but_player() {
$excluded_users_but_player = implode(',',get_users('role=coach&fields=ID'));
$excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=seniorcoach&fields=ID'));
$excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=subscriber&fields=ID'));
$excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=editor&fields=ID'));
$excluded_users_but_player = $excluded_users_but_player.','.implode(',',get_users('role=administrator&fields=ID'));
return $excluded_users_but_player;
}function bp_exclude_users_but_coach() {
$excluded_users_but_coach = implode(',',get_users('role=player&fields=ID'));
//$excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=seniorcoach&fields=ID'));
$excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=subscriber&fields=ID'));
$excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=editor&fields=ID'));
$excluded_users_but_coach = $excluded_users_but_coach.','.implode(',',get_users('role=administrator&fields=ID'));
return $excluded_users_but_coach;
}function bp_exclude_users_but_senior_coach() {
$excluded_users_but_senior_coach = implode(',',get_users('role=player&fields=ID'));
$excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=coach&fields=ID'));
$excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=subscriber&fields=ID'));
$excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=editor&fields=ID'));
$excluded_users_but_senior_coach = $excluded_users_but_senior_coach.','.implode(',',get_users('role=administrator&fields=ID'));
return $excluded_users_but_senior_coach;
}function bp_exclude_cc_backend_users() {
$excluded_cc_backend_users = implode(',',get_users('role=subscriber&fields=ID'));
$excluded_cc_backend_users = $excluded_cc_backend_users.','.implode(',',get_users('role=editor&fields=ID'));
$excluded_cc_backend_users = $excluded_cc_backend_users.','.implode(',',get_users('role=administrator&fields=ID'));
return $excluded_cc_backend_users;
}
Member Loop that calls member “Coach” filter:
<?php if ( bp_has_members( bp_ajax_querystring( 'members').'&exclude='.bp_exclude_users_but_coach().'&per_page=24' ) ) : ?>
And this is the problematic page template code (The one that filters by role type (coach))
<?php
/**
* The template for displaying all pages
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages and that
* other 'pages' on your WordPress site will use a different template.
*
* @package WordPress
* @subpackage Kleo
* @since Kleo 1.0
*/get_header(); ?>
<?php get_template_part('page-parts/general-title-section'); ?>
<?php get_template_part('page-parts/general-before-wrap'); ?>
<?php
if ( have_posts() ) :
// Start the Loop.
while ( have_posts() ) : the_post();
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', 'page' );
endwhile;
endif;
?><?php do_action( 'bp_before_directory_members_page' ); ?>
<section class="container-wrap main-color">
<div class="section-container container"><div id="buddypress">
<?php do_action( 'bp_before_directory_members' ); ?>
<?php do_action( 'bp_before_directory_members_content' ); ?>
<!--<div id="members-dir-search" class="dir-search" role="search">
<?php //bp_directory_members_search_form(); ?>
</div>--><!-- #members-dir-search --><?php do_action( 'bp_before_directory_members_tabs' ); ?>
<form action="" method="post" id="members-directory-form" class="dir-form">
<div id="subnav" class="item-list-tabs" role="navigation">
-
<!--<li class="selected" id="members-all">"><?php //printf( __( 'All Members <span>%s</span>', 'buddypress' ), bp_get_total_member_count() ); ?>--> <!--Contatore membri totali-->
<?php //if ( is_user_logged_in() && bp_is_active( 'friends' ) && bp_get_total_friend_count( bp_loggedin_user_id() ) ) : ?>
<!--<li id="members-personal">"><?php //printf( __( 'My Friends <span>%s</span>', 'buddypress' ), bp_get_total_friend_count( bp_loggedin_user_id() ) ); ?>-->
<?php //endif; ?><?php //do_action( 'bp_members_directory_member_types' ); ?>
<?php //do_action( 'bp_members_directory_member_sub_types' ); ?>
<!--<li id="members-order-select" class="last filter">
<label for="members-order-by"><?php //_e( 'Order By:', 'buddypress' ); ?></label>
<select id="members-order-by">
<option value="active"><?php //_e( 'Last Active', 'buddypress' ); ?></option>
<option value="newest"><?php //_e( 'Newest Registered', 'buddypress' ); ?></option><?php //if ( bp_is_active( 'xprofile' ) ) : ?>
<option value="alphabetical"><?php _e( 'Alphabetical', 'buddypress' ); ?></option>
<?php //endif; ?><?php //do_action( 'bp_members_directory_order_options' ); ?>
</select>
--></div><!-- .item-list-tabs -->
<div id="members-dir-list" class="members dir-list">
<?php
/**
* BuddyPress - Members Loop
*
* Querystring is set via AJAX in _inc/ajax.php - bp_legacy_theme_object_filter()
*
* @package BuddyPress
* @subpackage bp-legacy
*/?>
<?php if ( bp_has_members( bp_ajax_querystring( 'members').'&exclude='.bp_exclude_users_but_coach().'&per_page=24' ) ) : ?>
<div id="pag-top" class="pagination">
<div class="pag-count" id="member-dir-count-top">
<?php bp_members_pagination_count(); ?>
</div>
<div class="pagination-links" id="member-dir-pag-top">
<?php bp_members_pagination_links(); ?>
</div>
</div><?php do_action( 'bp_before_directory_members_list' ); ?>
<ul id="members-list" class="item-list row kleo-isotope masonry">
<?php while ( bp_members() ) : bp_the_member(); ?>
<?php $user_info = get_userdata(bp_get_member_user_id()); ?>
<?php
$user_roles = $user_info->roles;
$user_role = array_shift($user_roles);// echo 'User ID: ' . $user_info->ID . "\n";
// echo bp_core_get_user_displayname( $user_info->ID ) ;
// echo $user_info->ID ;
?><li class="kleo-masonry-item type-<?php echo $user_role; ?>">
ID ; ?>' value='show/hide'> <!-- link che apre info's nascoste -->
<div class="member-inner-list animated animate-when-almost-visible bottom-to-top">
<div class="item-avatar rounded">
<!-- ">
--> <?php bp_member_avatar( 'type=full&height=150&width=150' ); ?>
<!-- -->
<?php //do_action('bp_member_online_status', bp_get_member_user_id()); ?>
</div>
<!-- "> -->
<div class="item">
<div class="item-title"><span class="loop-nome"><?php bp_member_name(); ?></span><span class="loop-cognome"><?php bp_member_profile_data( 'field=Cognome' ); ?></span></div><!-- <?php if ( bp_get_member_latest_update() ) : ?>
<span class="update"> <?php bp_member_latest_update(); ?></span>
<?php endif; ?>
-->
<?php do_action( 'bp_directory_members_item' ); ?><?php
/***
* If you want to show specific profile fields here you can,
* but it'll add an extra query for each member in the loop
* (only one regardless of the number of fields you show):
*
* bp_member_profile_data( 'field=the field name' );
*/
?></div>
</div><!--end member-inner-list-->
<!-- link che apre informazioni nascoste -->
<div id="contenuto-nascosto-<?php echo $user_info->ID ; ?>" class="hidden-infos">
<div class="nascondi-infos">
ID ; ?>' value='show/hide'>
<i class="icon-cancel"></i>
</div>
<div class="unhidden-infos unhidden-infos-first ">
<div class="item-avatar-small">
">
<?php bp_member_avatar( 'type=full&height=50&width=50' ); ?>
<?php do_action('bp_member_online_status', bp_get_member_user_id()); ?>
</div>
</div>
<div class="unhidden-infos">
<div class="item-title">
">
<span class="loop-nome"><?php bp_member_name(); ?></span>
">
<span class="loop-cognome"><?php bp_member_profile_data( 'field=Cognome' ); ?></span>
</div>
</div>
<div class="unhidden-infos">
<span class="nomeazienda-titolo custom-title">Azienda:</span>
<span class="nomeazienda custom-infos"><?php bp_member_profile_data( 'field=Azienda' ); ?></span>
</div>
<div class="unhidden-infos">
<span class="pos-lavorativa-title custom-title">Funzione:</span>
<span class="pos-lavorativa custom-infos"><?php bp_member_profile_data( 'field=Funzione' ); ?></span>
</div>
<div class="unhidden-infos">
<span class="settore-title custom-title">Settore:</span>
<span class="settore custom-infos"><?php bp_member_profile_data( 'field=Settore' ); ?></span>
</div>
<div class="unhidden-infos">
<span class="laurea-title custom-title">Laurea:</span>
<span class="laurea custom-infos"><?php bp_member_profile_data( 'field=Laurea' ); ?></span>
</div><div class="action">
<div class="generic-button" id="send-private-message">
" title="Clicca per profilo completo" class="send-message">Profilo Completo
</div><?php //do_action( 'bp_directory_members_actions' ); ?>
</div>
</div><script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#nascondi-mostra-<?php echo $user_info->ID ; ?>').live('click', function(event) {
jQuery('#contenuto-nascosto-<?php echo $user_info->ID ; ?>').toggle('show');
});
});
</script><?php endwhile; ?>
<?php do_action( 'bp_after_directory_members_list' ); ?>
<?php bp_member_hidden_fields(); ?>
<?php else: ?>
<div id="message" class="info">
<p><?php _e( "Sorry, no members were found.", 'buddypress' ); ?></p>
</div><?php endif; ?>
<?php do_action( 'bp_after_members_loop' ); ?>
</div><!-- #members-dir-list -->
<?php do_action( 'bp_directory_members_content' ); ?>
<?php wp_nonce_field( 'directory_members', '_wpnonce-member-filter' ); ?>
<?php do_action( 'bp_after_directory_members_content' ); ?>
</form><!-- #members-directory-form -->
<?php do_action( 'bp_after_directory_members' ); ?>
</div><!-- #buddypress -->
</div>
</section><?php do_action( 'bp_after_directory_members_page' ); ?>
<?php get_template_part('page-parts/general-after-wrap'); ?>
<?php get_footer(); ?>