From 545a67f9384e1ad124bc0e7ac272e430d8e83fcb Mon Sep 17 00:00:00 2001 From: sumaisa-mou Date: Wed, 4 Oct 2023 15:18:23 +0600 Subject: [PATCH] Update new url for team feature. --- includes/Core/Auth/Auth.php | 2 +- includes/Core/User/Integrations/WpUser.php | 2 +- includes/Rest/Users.php | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/includes/Core/Auth/Auth.php b/includes/Core/Auth/Auth.php index 6f2937c4..469d05c4 100644 --- a/includes/Core/Auth/Auth.php +++ b/includes/Core/Auth/Auth.php @@ -88,7 +88,7 @@ public function site( $api = '' ) { 'include' => 'role,permissions', ]; - $wp_admin_response = wemail()->api->auth()->users()->post( $data ); + $wp_admin_response = wemail()->api->teamUsers()->post( $data ); if ( ! empty( $wp_admin_response['access_token'] ) ) { $user_meta = [ diff --git a/includes/Core/User/Integrations/WpUser.php b/includes/Core/User/Integrations/WpUser.php index 633a88ff..71836adf 100644 --- a/includes/Core/User/Integrations/WpUser.php +++ b/includes/Core/User/Integrations/WpUser.php @@ -158,7 +158,7 @@ protected function check_role( $roles, $role ) { * @param string $role */ protected function create_wemail_user( $user, $role ) { - $response = wemail()->api->auth()->users()->post( + $response = wemail()->api->teamUsers()->post( [ 'name' => $user->data->display_name, 'email' => $user->data->user_email, diff --git a/includes/Rest/Users.php b/includes/Rest/Users.php index f4ad9a93..b8a6c62e 100644 --- a/includes/Rest/Users.php +++ b/includes/Rest/Users.php @@ -61,7 +61,7 @@ public function store( $request ) { wemail()->api->set_api_key( $access_token[0] ); foreach ( $users as $user ) { - $wp_admin_response = wemail()->api->auth()->users()->post( + $wp_admin_response = wemail()->api->teamUsers()->post( [ 'name' => $user['name'], 'email' => $user['email'], @@ -136,7 +136,7 @@ public function toggleStatus( $request ) { $status = $request->get_param( 'status' ); $user = get_user_by( 'email', $email ); if ( $user ) { - $wp_admin_response = wemail()->api->auth()->users()->status()->post( + $wp_admin_response = wemail()->api->team()->users()->status()->post( [ 'email' => $email, 'status' => $status, @@ -173,13 +173,10 @@ public function roles() { $available_roles = []; foreach ( $roles->roles as $key => $role ) { if ( $key !== 'subscriber' ) { - array_push( - $available_roles, - [ - 'slug' => $key, - 'name' => $role['name'], - ] - ); + $available_roles[] = [ + 'slug' => $key, + 'name' => $role['name'], + ]; } }