Change user role after creation to match WooCommerce
This commit is contained in:
parent
faa62bb9ad
commit
99db86f10c
@ -183,6 +183,11 @@ class _AccountRegistrationPageState extends NyState<AccountRegistrationPage> {
|
|||||||
username: username,
|
username: username,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (wpUserRegisterResponse?.data?.userToken != null) {
|
||||||
|
await WPJsonAPI.instance.api((request) => request.wpUserAddRole(wpUserRegisterResponse!.data!.userToken, role: "customer"));
|
||||||
|
await WPJsonAPI.instance.api((request) => request.wpUserRemoveRole(wpUserRegisterResponse!.data!.userToken, role: "subscriber"));
|
||||||
|
}
|
||||||
} on UsernameTakenException catch (e) {
|
} on UsernameTakenException catch (e) {
|
||||||
showToastNotification(context,
|
showToastNotification(context,
|
||||||
title: trans("Oops!"),
|
title: trans("Oops!"),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user