Search.../

joinCommunity( )

Joins the currently logged-in member to the site community and sets their profile to public.

Description

When a member's profile is public, they have access to the site's Members Area features — such as chat, forum, and followers — and their profile is visible to other members and site visitors.

Note: Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.

Syntax

function joinCommunity(): Promise<JoinCommunityResponse>

joinCommunity Parameters

This function does not take any parameters.

Returns

Member profile.

Return Type:

Promise<
JoinCommunityResponse
>
NAME
TYPE
DESCRIPTION
member
Member

The updated member.

Was this helpful?

Make currently logged-in member's profile public (export from backend code)

Copy Code
1import { members } from 'wix-members.v2';
2import { webMethod, Permissions } from 'wix-web-module';
3
4export const myJoinCommunityFunction = webMethod(
5 Permissions.Anyone,
6 async () => {
7 try {
8 const member = await members.joinCommunity();
9 console.log('Joined site community:', member);
10
11 return member;
12 } catch (error) {
13 console.error(error);
14 // Handle the error
15 }
16 }
17);
18
19/* Promise resolves to:
20 * {
21 * "member": {
22 * "createdDate": "2024-02-22T13:52:00Z",
23 * "id": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32",
24 * "updatedDate": "2024-02-22T13:52:00.674Z",
25 * "activityStatus": "ACTIVE",
26 * "contact": {
27 * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12",
28 * "firstName": "John",
29 * "lastName": "Doe",
30 * "phones": [],
31 * "emails": [],
32 * "addresses": [],
33 * "customFields": {}
34 * },
35 * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12",
36 * "lastLoginDate": "2024-02-29T11:40:21Z",
37 * "loginEmail": "johndoe@example.com",
38 * "loginEmailVerified": true,
39 * "privacyStatus": "PUBLIC",
40 * "profile": {
41 * "nickname": "John Doe",
42 * "slug": "johndoe",
43 * "photo": {
44 * "id": "",
45 * "url": "https://example.com/newphoto.jpg",
46 * "height": 0,
47 * "width": 0
48 * }
49 * },
50 * "status": "APPROVED"
51 * }
52 * }
53 */
Make the currently logged-in member's profile public (Dashboard page code)

Copy Code
1import { members } from 'wix-members.v2';
2
3export async function myJoinCommunityFunction(){
4 try {
5 const member = await members.joinCommunity();
6 console.log('Joined site community:', member);
7
8 return member;
9 } catch (error) {
10 console.error(error);
11 // Handle the error
12 }
13}
14
15/* Promise resolves to:
16 * {
17 * "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",
18 * "_createdDate": "2021-08-02T23:14:42.000Z",
19 * "_updatedDate": "2021-08-02T23:14:58.345Z",
20 * "lastLoginDate": "2021-08-04T11:02:44.000Z",
21 * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",
22 * "loginEmail": "claude.morales@example.com",
23 * "loginEmailVerified": true,
24 * "status": "APPROVED",
25 * "privacyStatus": "PUBLIC",
26 * "activityStatus": "ACTIVE",
27 * "contact": {
28 * "firstName": "Claude",
29 * "lastName": "Morales",
30 * "phones": [
31 * "0747-769-460"
32 * ],
33 * "emails": [
34 * "claude.morales@example.com"
35 * ],
36 * "addresses": [
37 * {
38 * "_id": "f0f4d905-488d-44db-9080-fc29078cfad5",
39 * "addressLine": "9373 Park Avenue",
40 * "addressLine2": "Berkshire",
41 * "city": "Ely",
42 * "subdivision": "GB-ENG",
43 * "country": "GB",
44 * "postalCode": "PD50 8EU"
45 * }
46 * ],
47 * "customFields": {}
48 * },
49 * "profile": {
50 * "nickname": "Claude Morales",
51 * "slug": "claudemorales"
52 * }
53 * }
54 */