Removes members from a group.
The removeGroupMembers()
function returns a Promise that resolves when the member is removed from the group.
Note: Only site admins and group admins can remove members from their group. However, if the suppressAuth
option is set to true
, all permissions are overwritten and all site members (including non-group members) can remove members from a group.
function removeGroupMembers(
identifiers: IdentifiersRemoveGroupMembers,
options: Options,
): Promise<void>;
Group ID and member IDs.
Authorization options.
import { Permissions, webMethod } from "wix-web-module";
import { members } from "wix-groups-backend";
// Sample identifiers value:
// {
// groupId: '0261a737-2361-4468-a3b1-5ec2b0667836',
// memberIds: ['937cd3db-e9be-4980-93c1-a6d767a11050', '7fe8e9e1-d050-4c86-9684-e7f231600a34']
// }
//
// Sample options value:
// {
// suppressAuth: true
// }
export const myRemoveGroupMembersFunction = webMethod(
Permissions.Anyone,
(identifiers, options) => {
return members
.removeGroupMembers(identifiers, options)
.then((removedGroupMembers) => {
console.log("Removed group members");
})
.catch((error) => {
console.error(error);
});
},
);
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.