Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'hide admin in directory'

Viewing 25 results - 26 through 50 (of 99 total)
  • Author
    Search Results
  • #263784

    In reply to: Hide members

    beforeplastic
    Participant

    Thank 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’);

    #263153

    In reply to: Hide members

    beforeplastic
    Participant

    I 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’);

    #262411
    livingflame
    Participant

    Solution: HIDE ADMIN FROM BP WIDGETS AND DIRECTORY

    This code is complementary for the other ==>

    Hiding Users on BuddyPress based site

    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 );
    #262367
    livingflame
    Participant

    Please, Help!

    I need a Php code (functions.php) for Hide Admin(s) from BuddyPress Widget (Newest, Active, Popular… or whatever).

    Im using this ===> But, I need for Bp W.

    // 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’);
    #262296
    livingflame
    Participant

    @danbp
    Hi!
    Can you help me?
    How I can hide super admin’s vcard from BuddyPress Widgets??

    Your code only hide super admin from members and activity…

    // 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’);
    
     
    
     
    #261914
    livingflame
    Participant

    @henrywright

    This 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');
    
    
    ico33
    Participant

    Nothing 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’ );

    danbp
    Moderator

    The 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' );
    ico33
    Participant

    Thanks! 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

    ico33
    Participant

    @sbrajesh

    Hello 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' );
    ?>
    Brajesh Singh
    Participant

    Please 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.

    fidelduque
    Participant

    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

    danbp
    Moderator

    Hi @navyspitfire,

    when you pick up code somewhere, you should also read the comments. The solution to your issue was in one of them.

    Here is what wil exclude site admin from members directory and exclude also the logged_in user. The total member count will also be adjusted correctly on All members [x] tab and for the pagination count. $count-2 instead of $count-1 do the trick.

    Excluded members, incl. admin, are of course excluded from search.

    function bpex_hide_admin_on_member_directory( $qs=false, $object=false ){
    
    	// Id's to hide, separated by comma
    	$excluded_user = '1' ;
    
    	// hide to members & friends 
    	if($object != 'members' && $object != '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','bpex_hide_admin_on_member_directory', 20, 2 );
    
    // once admin is excluded, we must recount the members !
    function bpex_hide_get_total_filter( $count ){
    	return $count-2;
    }
    add_filter( 'bp_get_total_member_count', 'bpex_hide_get_total_filter' );
    
    function bpex_exclude_loggedin_user( $qs = false, $object = false ) {
    
     //list of users to exclude
     if( !is_user_logged_in() )
         return $qs;
    
     //if the user is logged in , let us exclude her/him
     $excluded_user=  get_current_user_id();
      
     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;
      
    }
    add_action('bp_ajax_querystring','bpex_exclude_loggedin_user', 20, 2 );

    Codex Reference

    Playing with the user’s ID in different contexts

    navyspitfire
    Participant

    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');
    #246094
    splufford
    Participant

    Hi, struggling to get any of the the code in post #190874 to work. I have created a bp-custom.php file which I have uploaded to the root of the buddpress folder and my code looks like this:

    <?php
    // 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 );
    ?>

    Not sure what I am doing wrong. All help gratefully received! Thanks

    lyndysmart
    Participant

    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?

    jackofallvices
    Participant

    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 Login

    9. 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.

    jreeve
    Participant

    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 like BP_Activity_Activity->save() is trying to access $bp->activity->table_name, but $bp->activity doesn’t have a table_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?

    Mickey
    Participant

    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.

    #238771
    micromart
    Participant

    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 you

    #235367
    Klosurdo
    Participant

    Hi,

    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,
    Ken

    The 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 );
    #235021
    danbp
    Moderator

    Hello,

    please try to search in topics if a similar question wasn’t ask in the past.
    hide+admin+in+admin

    A possible solution here.

    evitorino
    Participant

    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/&#8221; 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(); ?>

    #231214
    shayne
    Participant

    I figured it out. For some reason WordPress decided it would be a good idea to hide custom menus added to the toolbar(when did they change the name from admin bar?) when viewing it on mobile devices.

    If you browse through the WordPress directory you will find the css for the toolbar in wp-includes\css\admin-bar.css.

    This line hides everything but the default items from the toolbar.

    	/* Show only default top level items */
    	#wp-toolbar > ul > li {
        		display: none;
    	}

    By changing “display: none” to “display: block”. That fixed the problem i was having.

    So hopefully that information is useful to someone.

    Oh and one more thing. If you need to modify the toolbars css don’t do it there. You shouldn’t modify WordPress’s core files. Instead you should copy that css to your themes style sheet.

    danbp
    Moderator

    Please use the code button to insert code in a topic. Thank you !

    Give this a try

    // 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 );
Viewing 25 results - 26 through 50 (of 99 total)
Skip to toolbar