updateGroup( )


Updates a group.

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:

  • If the suppressAuth option is set to true, all permissions are overwritten, and all site members (including non-group members) can update a group.
  • 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.
Method Declaration
Copy
function updateGroup(
  groupId: string,
  groupInfo: GroupInfoUpdate,
  options: Options,
): Promise<Group>;
Method Parameters
groupIdstringRequired

ID of group to update.


groupInfoGroupInfoUpdateRequired

Group information to update.


optionsOptions

Authorization options.

Returns
Return Type:Promise<Group>
JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { groups } from "wix-groups-backend"; // Sample groupId value: // '83636377-b415-4ebe-ba41-df338c5ad6b7' // // Sample groupInfo value: // { // name: 'My Updated Group', // description: 'This is my updated group about cats.', // } export const myUpdateGroupFunction = webMethod( Permissions.Anyone, (groupId, groupInfo) => { return groups .updateGroup(groupId, groupInfo) .then((updatedGroup) => { const updatedGroupName = updatedGroup.name; const updatedGroupDescription = updatedGroup.description; return updatedGroup; }) .catch((error) => { console.error(error); }); }, ); /* Promise resolves to: * { * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7" * "name": "My Updated Group" * "slug": my-updated-group * "description": "This is my new group about cats." * "privacyStatus": "PUBLIC" * "coverImage": { * "imageUrl": "wix:image://v1/vcc6074e348009011fa9f2d29kk7~mv2.jpg/maple.jpg#originWidth=999&originHeight=240", * "position": { * "x": 30, * "y": 225 * } * } * "memberTitle": "Members" * "memberCount": 250 * "settings": { * "groupUpdatePostEnabled": true * "membersCanApprove": false * "membersCanInvite": true * "showMemberList": true * "welcomeMemberPostEnabled": true * } * "lastActivityDate": "Wed Nov 29 2021 18:23:23 GMT+0300" * "_createdDate": "Tues Jan 22 2020 12:56:02 GMT+0300" * "_updatedDate": "Wed Nov 29 2021 18:23:23 GMT+0300" * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34" * } */
Errors

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

Did this help?