bb_get_user_id

The BuddyPress bb get user id function.

Description

bb_get_user_id( (int) $id = 0 ); 

Parameters (1)

0. $id — Optional. (int)
The id.

Usage

  1. if ( !function_exists( 'bb_get_user_id' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The id. 
  5. $id = -1; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_get_user_id($id); 
  9.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-template.php  
  1. function bb_get_user_id( $id = 0 ) { 
  2. global $user; 
  3. if ( is_object($id) && isset($id->ID) ) 
  4. return (int) $id->ID; 
  5. elseif ( !$id ) 
  6. return $user->ID; 
  7.  
  8. $_user = bb_get_user( (int) $id ); 
  9. return isset($_user->ID) ? $_user->ID : 0;