bb_export_user

The BuddyPress bb export user function.

Description

bb_export_user( $user_id ); 

Parameters (1)

0. $user_id
The user id.

Usage

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

Defined (1)

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

/bp-forums/bbpress/bb-admin/export.php  
  1. function bb_export_user( $user_id ) { 
  2. global $bbdb; 
  3. if ( !$_user = bb_get_user( $user_id ) ) 
  4. return; 
  5.  
  6. $_user = get_object_vars($_user); 
  7.  
  8. $atts = array( 
  9. 'type' => 'user',  
  10. 'id' => $_user['ID'] 
  11. ); 
  12.  
  13. // ?url means url is optional. Only include it in the export if it exists 
  14. // !title means the title should be wrapped in CDATA 
  15. // ?! is the correct order, not !? 
  16. $translate = array( 
  17. 'user_login' => 'login',  
  18. 'user_pass' => 'pass',  
  19. 'user_email' => 'email',  
  20. 'user_url' => '?url',  
  21. 'user_registered' => 'incept',  
  22. 'display_name' => '?!title',  
  23. 'user_nicename' => '?nicename',  
  24. 'user_status' => '?status',  
  25. 'ID' => false 
  26. ); 
  27.  
  28. $user = _bb_translate_for_export( $translate, $_user ); 
  29.  
  30. $meta = array(); 
  31. foreach ( $_user as $k => $v ) { 
  32. if ( 0 !== strpos($k, $bbdb->prefix) && isset($_user[$bbdb->prefix . $k]) ) 
  33. continue; 
  34. $meta[$k] = maybe_serialize($v); 
  35. unset($_user, $k, $v); 
  36.  
  37. $user['meta'] = $meta; 
  38.  
  39. return _bb_export_object( $atts, $user );