BP_XProfile_ProfileData::get_all_for_user( int $user_id )
Get all of the profile information for a specific user.
Description
Parameters
- $user_id
-
(Required) ID of the user.
Return
(array)
Source
File: bp-xprofile/classes/class-bp-xprofile-profiledata.php
403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 | public static function get_all_for_user( $user_id ) { $groups = bp_xprofile_get_groups( array ( 'user_id' => $user_id , 'hide_empty_groups' => true, 'hide_empty_fields' => true, 'fetch_fields' => true, 'fetch_field_data' => true, ) ); $profile_data = array (); if ( ! empty ( $groups ) ) { $user = new WP_User( $user_id ); $profile_data [ 'user_login' ] = $user ->user_login; $profile_data [ 'user_nicename' ] = $user ->user_nicename; $profile_data [ 'user_email' ] = $user ->user_email; foreach ( ( array ) $groups as $group ) { if ( empty ( $group ->fields ) ) { continue ; } foreach ( ( array ) $group ->fields as $field ) { $profile_data [ $field ->name ] = array ( 'field_group_id' => $group ->id, 'field_group_name' => $group ->name, 'field_id' => $field ->id, 'field_type' => $field ->type, 'field_data' => $field ->data->value, ); } } } return $profile_data ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.