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:

  • 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.

Syntax

function updateGroup(groupId: string, groupInfo: GroupInfoUpdate, [options: Options]): Promise<Group>

updateGroup Parameters

NAME
TYPE
DESCRIPTION
groupId
string

ID of group to update.

groupInfo
GroupInfoUpdate

Group information to update.

options
Optional
Options

Authorization options.

Returns

Return Type:

Promise<Group>
NAME
TYPE
DESCRIPTION
_id
string

Group ID.

name
string

Group name.

slug
string

Part of a group's URL, for example, 'https:/example.com/groups/{my-group-slug}'. Generally based on the group name, but for secret groups it is an autogenerated string of characters, for example, 'https:/example.com/groups/{5D3yTX}'. It is case-sensitive.

description
string

Group description.

privacyStatus
string

Group privacy level. One of:

  • PUBLIC: Site visitors can see the group and its content in the list of groups. Site members can join the group.
  • PRIVATE: Site visitors can see the group in the list of groups, but only group members can see its content. Site members can request to join the group.
  • SECRET: Only group members can see the group and its content in the list of groups. Site members can only join if invited by group admins, or other group members.
coverImage
CoverImage

Group cover image.

memberTitle
string

What group members are called. For example, 'Coworkers', 'Friends', or 'Students'.

memberCount
number

Number of members in the group.

settings
GroupSettings

Group settings.

lastActivityDate
Date

Date and time the group was last active. For example, a post or comment.

_createdDate
Date

Date and time the group was created.

_updatedDate
Date

Date and time the group was last updated.

owner
string

Site member ID of the group creator. Defaults to group creator.

Was this helpful?

Update a group

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { groups } from 'wix-groups-backend';
3
4export const myUpdateGroupFunction = webMethod(Permissions.Anyone, (groupId, groupInfo) => {
5 return groups.updateGroup(groupId, groupInfo)
6 .then((updatedGroup) => {
7 const updatedGroupName = updatedGroup.name;
8 const updatedGroupDescription = updatedGroup.description;
9 return updatedGroup;
10 })
11 .catch((error) => {
12 console.error(error);
13 });
14});
15
16/* Promise resolves to:
17 * {
18 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
19 * "name": "My Updated Group"
20 * "slug": my-updated-group
21 * "description": "This is my new group about cats."
22 * "privacyStatus": "PUBLIC"
23 * "coverImage": {
24 * "imageUrl": "wix:image://v1/vcc6074e348009011fa9f2d29kk7~mv2.jpg/maple.jpg#originWidth=999&originHeight=240",
25 * "position": {
26 * "x": 30,
27 * "y": 225
28 * }
29 * }
30 * "memberTitle": "Members"
31 * "memberCount": 250
32 * "settings": {
33 * "groupUpdatePostEnabled": true
34 * "membersCanApprove": false
35 * "membersCanInvite": true
36 * "showMemberList": true
37 * "welcomeMemberPostEnabled": true
38 * }
39 * "lastActivityDate": "Wed Nov 29 2021 18:23:23 GMT+0300"
40 * "_createdDate": "Tues Jan 22 2020 12:56:02 GMT+0300"
41 * "_updatedDate": "Wed Nov 29 2021 18:23:23 GMT+0300"
42 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
43 * }
44 */
Update a group with more information

Copy Code
1import { Permissions, webMethod } from 'wix-web-module';
2import { groups } from 'wix-groups-backend';
3
4export const myUpdateGroupFunction = webMethod(Permissions.Anyone, (groupId, groupInfo, options) => {
5 return groups.updateGroup(groupId, groupInfo, options)
6 .then((updatedGroup) => {
7 const updatedGroupName = updatedGroup.name;
8 const updatedGroupDescription = updatedGroup.description;
9 return updatedGroup;
10 })
11 .catch((error) => {
12 console.error(error);
13 });
14});
15
16/* Promise resolves to:
17 * {
18 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"
19 * "name": "My Updated Group"
20 * "slug": my-updated-group
21 * "description": "This is my new group about cats."
22 * "privacyStatus": "PRIVATE"
23 * "coverImage": {
24 * "imageUrl": "wix:image://v1/n6p6074e348009011fa9f2d29j~mv2.jpg/salami.jpg#originWidth=227&originHeight=2240",
25 * "position": {
26 * "x": 30,
27 * "y": 225
28 * }
29 * }
30 * "memberTitle": "Friends"
31 * "memberCount": 250
32 * "settings": {
33 * "groupUpdatePostEnabled": false
34 * "membersCanApprove": true
35 * "membersCanInvite": false
36 * "showMemberList": false
37 * "welcomeMemberPostEnabled": false
38 * }
39 * "lastActivityDate": "Wed Nov 29 2021 18:23:23 GMT+0300"
40 * "_createdDate": "Tues Jan 22 2020 12:56:02 GMT+0300"
41 * "_updatedDate": "Wed Nov 29 2021 18:23:23 GMT+0300"
42 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"
43 * }
44 */