Search.../

removeMembers( )

Removes site members from an assigned badge.

Description

The removeMembers() function returns a Promise that resolves when the specified members are removed as holders of the specified badge.

Note: This function replaces the deprecated wix-users-backend.badges.removeMembers(). The deprecated function will continue to work, but it will not receive updates. To keep any existing code compatible with future changes, see the migration instructions.

The badgeId parameter must be an ID from your site's Members/Badges collection. Typically, you retrieve the ID from the collection using a query or through a dataset.

Syntax

function removeMembers(badgeId: string, memberIds: Array<string>): Promise<void>

removeMembers Parameters

NAME
TYPE
DESCRIPTION
badgeId
string

ID of the badge to remove the members from.

memberIds
Array<string>

IDs of the members to remove from the badge.

Returns

Fulfilled - Members are removed. Rejected - Error message.

Return Type:

Promise<void>

Was this helpful?

Remove members from an assigned badge

Copy Code
1import { badges } from 'wix-members-backend';
2
3export function myRemoveMembersFunction() {
4 const badgeId = "3fcaacc0-a3a7-464f-9ba9-f211bdcec9fc";
5 const memberIds = [
6 "efab296e-2687-4751-9956-ee73200dd4bb",
7 "3403e13b-8826-4af6-aa19-18784bb84a8e",
8 "28d35f86-6694-4455-9dff-aff5d450b482"
9 ];
10
11 return badges.removeMembers(badgeId, memberIds)
12 .then(() => {
13 console.log("Members removed from badge");
14 })
15 .catch((error) => {
16 console.error(error);
17 });
18}