bb_get_current_user_info

The BuddyPress bb get current user info function.

Description

bb_get_current_user_info( (string) $key = '' ); 

Parameters (1)

0. $key — Optional. (string) => ''
The key.

Usage

  1. if ( !function_exists( 'bb_get_current_user_info' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-template.php'; 
  3.  
  4. // The key. 
  5. $key = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bb_get_current_user_info($key); 
  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_current_user_info( $key = '' ) { 
  2. if ( !is_string($key) ) 
  3. return; 
  4. if ( !$user = bb_get_current_user() ) // Not globalized 
  5. return false; 
  6.  
  7. switch ( $key ) : 
  8. case '' : 
  9. return $user; 
  10. break; 
  11. case 'id' : 
  12. case 'ID' : 
  13. return (int) $user->ID; 
  14. break; 
  15. case 'name' : 
  16. return get_user_display_name( $user->ID ); 
  17. break; 
  18. case 'login' : 
  19. case 'user_login' : 
  20. return get_user_name( $user->ID ); 
  21. break; 
  22. case 'email' : 
  23. case 'user_email' : 
  24. return bb_get_user_email( $user->ID ); 
  25. break; 
  26. case 'url' : 
  27. case 'uri' : 
  28. case 'user_url' : 
  29. return get_user_link( $user->ID ); 
  30. break; 
  31. endswitch;