• Resolved HansRuedi

    (@schwarzaufweiss)


    I’m using the following code from Brajesh Singh (buddydev.com) to hide the site admin in BP member list:

    add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
    function bpdev_exclude_users($qs=false,$object=false){
     //list of users to exclude
     
     $excluded_user='1';//comma separated ids of users whom you want to exclude
     
     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;
     
    }
    

    Would somebody please help me to hide admin in Cleverness To-do List (in the frontend list of users where a to-do can be assigned to a user).

Viewing 1 replies (of 1 total)
  • Thread Starter HansRuedi

    (@schwarzaufweiss)

    I just found a solution (put it in functions.php of your active theme)…

    add_action('pre_user_query','yoursite_pre_user_query');
    function yoursite_pre_user_query($user_search) {
      global $current_user;
      $username = $current_user->user_login;
     
      if ($username == '<YOUR USERNAME>') { 
     
      }
     
      else {
        global $wpdb;
        $user_search->query_where = str_replace('WHERE 1=1',
          "WHERE 1=1 AND {$wpdb->users}.user_login != '<YOUR USERNAME>'",$user_search->query_where);
      }
    }
    
Viewing 1 replies (of 1 total)
  • The topic ‘Hide Admin User’ is closed to new replies.