bb_profile_data

The BuddyPress bb profile data function.

Description

bb_profile_data( (int) $id = 0 ); 

Parameters (1)

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

Usage

  1. if ( !function_exists( 'bb_profile_data' ) ) { 
  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_profile_data($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_profile_data( $id = 0 ) { 
  2. if ( !$user = bb_get_user( bb_get_user_id( $id ) ) ) 
  3. return; 
  4.  
  5. $reg_time = bb_gmtstrtotime( $user->user_registered ); 
  6. $profile_info_keys = bb_get_profile_info_keys(); 
  7. echo "<dl id='userinfo'>\n"; 
  8. echo "\t<dt>" . __('Member Since') . "</dt>\n"; 
  9. echo "\t<dd>" . bb_datetime_format_i18n($reg_time, 'date') . ' (' . bb_since($reg_time) . ")</dd>\n"; 
  10. if ( is_array( $profile_info_keys ) ) { 
  11. foreach ( $profile_info_keys as $key => $label ) { 
  12. if ( in_array($key, array('first_name', 'last_name', 'display_name')) || !isset($user->$key) ) 
  13. continue; 
  14. $val = 'user_url' == $key ? get_user_link( $user->ID ) : $user->$key; 
  15. if ( 
  16. ( 'user_email' != $key || ( 'user_email' == $key && bb_current_user_can( 'edit_users' ) ) ) 
  17. && $val 
  18. && 'http://' != $val 
  19. ) { 
  20. echo "\t<dt>{$label[1]}</dt>\n"; 
  21. $val = make_clickable( $val ); 
  22. $attributes = array(); 
  23. if (isset($label[2]) && !empty($label[2])) 
  24. if (preg_match("#^<a#i", $val)) 
  25. $val = preg_replace("#^<a#i", '<a class="' . esc_attr($label[2]) . '"', $val); 
  26. else 
  27. $val = '<span class="' . esc_attr($label[2]) . '">' . $val . '</span>'; 
  28.  
  29. echo "\t<dd>" . $val . "</dd>\n"; 
  30. echo "</dl>\n";