Update class-opalestate-api.php

This commit is contained in:
Hoang Huu 2019-10-23 09:27:14 +07:00
parent b8c6530801
commit c270a835c4

View File

@ -20,7 +20,7 @@ class Opalestate_API {
public function __construct() { public function __construct() {
$this->init(); $this->init();
add_filter( 'jwt_auth_token_before_dispatch', [ $this, 'jwt_auth_token_before_dispatch' ] ); add_filter( 'jwt_auth_token_before_dispatch', [ $this, 'jwt_auth_token_before_dispatch' ], 10, 2 );
} }
/** /**
@ -96,7 +96,7 @@ class Opalestate_API {
* @return array * @return array
*/ */
public function jwt_auth_token_before_dispatch( $data, $user ) { public function jwt_auth_token_before_dispatch( $data, $user ) {
$data['user_role'] = $user->data->display_name; $data['user_role'] = $user->roles;
$data['avatar'] = opalestate_get_user_meta( $user->data->ID, 'avatar' ); $data['avatar'] = opalestate_get_user_meta( $user->data->ID, 'avatar' );
return $data; return $data;