Advertisement
verygoodplugins

Untitled

Oct 3rd, 2020
1,093
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.81 KB | None | 0 0
  1.     /**
  2.      * Gets XProfile fields from the database when exporting metadata
  3.      *
  4.      * @access  public
  5.      * @return  array User Meta
  6.      */
  7.  
  8.     public function get_user_meta( $user_meta, $user_id ) {
  9.  
  10.         if ( ! class_exists( 'BP_XProfile_ProfileData' ) ) {
  11.             return $user_meta;
  12.         }
  13.  
  14.         $user_data = BP_XProfile_ProfileData::get_all_for_user( $user_id );
  15.  
  16.         foreach ( $user_data as $field ) {
  17.  
  18.             if ( is_array( $field ) && isset( $field['field_id'] ) ) {
  19.  
  20.                 $data = maybe_unserialize( $field['field_data'] );
  21.  
  22.                 // Clean up special characters
  23.  
  24.                 if ( is_array( $data ) ) {
  25.                     $data = array_map( 'htmlspecialchars_decode', $data );
  26.                 } else {
  27.                     $data = htmlspecialchars_decode( $data );
  28.                 }
  29.  
  30.                 $user_meta[ 'bbp_field_' . $field['field_id'] ] = $data;
  31.  
  32.             }
  33.         }
  34.  
  35.         return $user_meta;
  36.  
  37.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement