Search.../

updateGroup( )

Updates a group.

Description

The updateGroup() function returns a Promise that resolves to the updated group. Only site admins and group admins can update their group. Only the fields in the groupInfo object parameter can be updated. Specify which fields to update. Unspecified fields remain the same.

Notes:

  • When a group's privacyStatus is updated from PRIVATE to PUBLIC, all pending join requests for that group are automatically approved.
  • When a group's privacyStatus is updated from PRIVATE to SECRET, all pending join requests for that group are automatically rejected.
  • When a public or private group's name is updated, the slug is updated to reflect the new group name.
Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function updateGroup(_id: string, group: UpdateGroup): Promise<UpdateGroupResponse>

updateGroup Parameters

NAME
TYPE
DESCRIPTION
_id
string

Group ID.

group
UpdateGroup

Returns

Return Type:

Promise<
UpdateGroupResponse
>
NAME
TYPE
DESCRIPTION
group
Group

Updated group.

Was this helpful?

updateGroup example

Copy Code
1import { groups } from 'wix-groups.v2';
2
3 async function updateGroup(id, group) {
4 try {
5 const result = await groups.updateGroup(id, group);
6
7 return result;
8 } catch (error) {
9 console.error(error);
10 // Handle the error
11 }
12 }
13