Skip to content

Commit

Permalink
Merge pull request #502 from buddypress/feature/signup-fields-8976
Browse files Browse the repository at this point in the history
Registration through REST API with additional profile fields
  • Loading branch information
renatonascalves authored May 4, 2024
2 parents 7c8d07b + 9f218a2 commit c50601d
Show file tree
Hide file tree
Showing 6 changed files with 662 additions and 177 deletions.
13 changes: 8 additions & 5 deletions includes/bp-members/classes/class-bp-rest-members-endpoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -714,11 +714,14 @@ public function user_data( $user, $context, $request ) {
}

if ( 'edit' === $context && current_user_can( 'list_users' ) ) {
$data['registered_date'] = bp_rest_prepare_date_response( $user->data->user_registered, get_date_from_gmt( $user->data->user_registered ) );
$data['registered_date_gmt'] = bp_rest_prepare_date_response( $user->data->user_registered );
$data['roles'] = (array) array_values( $user->roles );
$data['capabilities'] = (array) array_keys( $user->allcaps );
$data['extra_capabilities'] = (array) array_keys( $user->caps );
if ( isset( $user->data ) ) {
$data['registered_date'] = bp_rest_prepare_date_response( $user->data->user_registered, get_date_from_gmt( $user->data->user_registered ) );
$data['registered_date_gmt'] = bp_rest_prepare_date_response( $user->data->user_registered );
}

$data['roles'] = isset( $user->roles ) ? array_values( (array) $user->roles ) : array();
$data['capabilities'] = isset( $user->allcaps ) ? array_keys( (array) $user->allcaps ) : array();
$data['extra_capabilities'] = isset( $user->caps ) ? array_keys( (array) $user->caps ) : array();
}

// The name used for that user in @-mentions.
Expand Down
Loading

0 comments on commit c50601d

Please sign in to comment.