approveCreateRequests( )
Approves requests to create a group.
Description
Note: This function is only relevant if admin approval is required for creating a group, or if the function's
suppressAuth
option is set totrue
.
The approveCreateRequests()
function returns a Promise that resolves when a site member's request to create a group is approved.
Only site admins can approve requests to create a group. When the request is approved, the new group is added to the Groups List page of your site.
Note: If the
suppressAuth
option is set totrue
, all permissions are overwritten, and all site members can approve requests to create a group.
Syntax
function approveCreateRequests(createRequestIds: Array<string>, [options: Options]): Promise<Array<CreateRequest>>
approveCreateRequests Parameters
NAME
TYPE
DESCRIPTION
IDs of the create requests to approve.
Authorization options.
Returns
Return Type:
NAME
TYPE
DESCRIPTION
ID of the request to create a group. Same as group ID.
Status of the request to create a group. One of:
"PENDING"
"APPROVED"
"REJECTED"
Reason the request to create a group was rejected.
Group requested to create.
Was this helpful?
Approve a request to create a group
1import { Permissions, webMethod } from 'wix-web-module';2import { createRequests } from 'wix-groups-backend';34// Sample createRequestIds value:5// ['8a3be85ea03e4b8b82f2f9c989557c3d', '6ff5333-b477-4e9tt-ba4j-df338c5ad6221']6//78export const myApproveCreateRequestsFunction = webMethod(Permissions.Anyone, async (createRequestIds) => {9 try {10 const approvedCreateRequests = await createRequests.approveCreateRequests(createRequestIds);11 return approvedCreateRequests;12 } catch (error) {13 console.error(error);14 }15});1617/* Promise resolves to:18 * [19 * {20 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7",21 * "status": "APPROVED"22 * "group": {23 * "_id": "83636377-b415-4ebe-ba41-df338c5ad6b7"24 * "name": "My Group Request 1"25 * "slug": "my-group-request-1"26 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."27 * "privacyStatus": "PRIVATE"28 * "coverImage": {29 * "imageUrl": "wix:image://v1/ff9074e348009011fa9f2d2961b~mv2.jpg/oak.jpg#originWidth=400&originHeight=900",30 * "position": {31 * "x": 20,32 * "y": 2533 * }34 * }35 * "memberTitle": "Friends"36 * "memberCount": 137 * "settings": {38 * "groupUpdatePostEnabled": true39 * "membersCanApprove": false40 * "membersCanInvite": true41 * "showMemberList": true42 * "welcomeMemberPostEnabled": true43 * }44 * "lastActivityDate": "Sun Sep 26 2021 08:23:23 GMT+0300"45 * "_createdDate": "Tues January 22 2021 12:56:02 GMT+0300"46 * "_updatedDate": "Fri October 2 2021 04:56:22 GMT+0300"47 * "owner": "9ne8e9e1-d050-4c86-9684-e7f231600a34"48 * }49 * },50 * {51 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221",52 * "status": "APPROVED"53 * "group": {54 * "_id": "6ff5333-b477-4e9tt-ba4j-df338c5ad6221"55 * "name": "My Group Request 2"56 * "slug": "my-group-request-2"57 * "description": "Welcome to the group! You can connect with other members, get updates and share videos."58 * "privacyStatus": "PRIVATE"59 * "coverImage": {60 * "imageUrl": "wix:image://v1/vcc6074e348009011fa9f2d29kk7~mv2.jpg/maple.jpg#originWidth=999&originHeight=240",61 * "position": {62 * "x": 730,63 * "y": 62564 * }65 * "memberTitle": "Members"66 * "memberCount": 3067 * "settings": {68 * "groupUpdatePostEnabled": true69 * "membersCanApprove": true70 * "membersCanInvite": true71 * "showMemberList": false72 * "welcomeMemberPostEnabled": true73 * }74 * "lastActivityDate": "Thurs Nov 12 2020 11:13:03 GMT+0300"75 * "_createdDate": "Wed May 14 2020 10:05:20 GMT+0300",76 * "_updatedDate": "Sun June 7 2020 09:07:33 GMT+0300"77 * "owner": "abe5e4e1-d950-4c46-8884-e7f231600d67"78 * }79 * }80 * ]81 */