bb_get_user

The BuddyPress bb get user function.

Description

bb_get_user( $user_id, (null) $args = null ); 

Parameters (2)

0. $user_id
The user id.
1. $args — Optional. (null) => null
The args.

Usage

  1. if ( !function_exists( 'bb_get_user' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-users.php'; 
  3.  
  4. // The user id. 
  5. $user_id = null; 
  6.  
  7. // The args. 
  8. $args = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_get_user($user_id, $args); 
  12.  

Defined (2)

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

/bp-forums/bbpress/bb-includes/functions.bb-users.php  
  1. function bb_get_user( $user_id, $args = null ) { 
  2. global $bbdb, $wp_users_object; 
  3.  
  4. // Get user 
  5. $user = $wp_users_object->get_user( $user_id, $args ); 
  6.  
  7. // Return on no user orerrorobject 
  8. if ( !is_object( $user ) || is_wp_error( $user ) ) 
  9. return false; 
  10.  
  11. // Re calculate the user's meta in case we're pulling from a value cached on another site 
  12. if ( $user_vars = get_object_vars( $user ) ) { 
  13. $prefix_length = strlen( $bbdb->prefix ); 
  14. foreach ( $user_vars as $k => $v ) { 
  15. if ( 0 === strpos( $k, $bbdb->prefix ) ) { 
  16. $user->{substr( $k, $prefix_length )} = $v; 
  17.  
  18. return $user; 
/bp-forums/bp-forums-bbpress-sa.php  
  1. function bb_get_user( $user_id ) { return get_userdata( $user_id ); }