bb_bozo_user_search_role_user_ids

The BuddyPress bb bozo user search role ids function.

Description

bb_bozo_user_search_role_user_ids( $role_user_ids, $roles, $args ); 

Parameters (3)

0. $role_user_ids
The role user ids.
1. $roles
The roles.
2. $args
The args.

Usage

  1. if ( !function_exists( 'bb_bozo_user_search_role_user_ids' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-plugins/bozo.php'; 
  3.  
  4. // The role user ids. 
  5. $role_user_ids = null; 
  6.  
  7. // The roles. 
  8. $roles = null; 
  9.  
  10. // The args. 
  11. $args = null; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = bb_bozo_user_search_role_user_ids($role_user_ids, $roles, $args); 
  15.  

Defined (1)

The function is defined in the following location(s).

/bp-forums/bbpress/bb-plugins/bozo.php  
  1. function bb_bozo_user_search_role_user_ids( $role_user_ids, $roles, $args ) 
  2. if ( !in_array( 'bozo', $roles ) ) { 
  3. return $role_user_ids; 
  4.  
  5. $bozo_user_ids = bb_bozo_get_bozo_user_ids(); 
  6.  
  7. if ( 1 === count( $roles ) ) { 
  8. return $bozo_user_ids; 
  9.  
  10. global $bbdb; 
  11. $role_meta_key = $bbdb->escape( $bbdb->prefix . 'capabilities' ); 
  12. $role_sql_terms = array(); 
  13. foreach ( $roles as $role ) { 
  14. if ( 'bozo' === $role ) { 
  15. continue; 
  16. $role_sql_terms[] = "`meta_value` LIKE '%" . $bbdb->escape( like_escape( $role ) ) . "%'"; 
  17. $role_sql_terms = join( ' OR ', $role_sql_terms ); 
  18. $role_sql = "SELECT `user_id` FROM `$bbdb->usermeta` WHERE `meta_key` = '$role_meta_key' AND ($role_sql_terms);"; 
  19. $role_user_ids = $bbdb->get_col( $role_sql, 0 ); 
  20. if ( is_wp_error( $role_user_ids ) || empty( $role_user_ids ) ) { 
  21. return array(); 
  22.  
  23. return array_intersect( (array) $bozo_user_ids, $role_user_ids );