removeRole( )


Removes a role from a member.

The removeRole() function returns a Promise that resolves when the specified role is removed from the specified member.

roleId must be an ID from an existing role in your site. The role ID can be copied from the Role Settings page. You can access the Role Settings page from your site's Member Permissions page.

Note: This function may take a few seconds until the role is assigned and the promise is resolved.

Method Declaration
Copy
function removeRole(
  roleId: string,
  memberId: string,
  options: AuthOptions,
): Promise<void>;
Method Parameters
roleIdstringRequired

ID of the role to remove from the member.


memberIdstringRequired

ID of the member to remove the role from.


optionsAuthOptions

Authorization options.

Remove a role from a member
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { authorization } from "wix-members-backend"; export const myRemoveRoleFunction = webMethod(Permissions.Anyone, () => { const roleId = "b62310c1-1c81-4ca9-9fe9-42b48f6e164e"; const memberId = "72751428-2743-4bda-acf5-4218a4279cd3"; const options = { suppressAuth: false, }; return authorization .removeRole(roleId, memberId, options) .then(() => { console.log("Role removed from member"); }) .catch((error) => { console.error(error); }); });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?