joinCommunity( )


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

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.

Method Declaration
Copy
function joinCommunity(): Promise<JoinCommunityResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<JoinCommunityResponse>
JavaScript
import { members } from "wix-members.v2"; import { webMethod, Permissions } from "wix-web-module"; export const myJoinCommunityFunction = webMethod( Permissions.Anyone, async () => { try { const member = await members.joinCommunity(); console.log("Joined site community:", member); return member; } catch (error) { console.error(error); // Handle the error } }, ); /* Promise resolves to: * { * "member": { * "createdDate": "2024-02-22T13:52:00Z", * "id": "7d368843-6f0c-4037-8d0e-b7e36a8a0c32", * "updatedDate": "2024-02-22T13:52:00.674Z", * "activityStatus": "ACTIVE", * "contact": { * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12", * "firstName": "John", * "lastName": "Doe", * "phones": [], * "emails": [], * "addresses": [], * "customFields": {} * }, * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12", * "lastLoginDate": "2024-02-29T11:40:21Z", * "loginEmail": "johndoe@example.com", * "loginEmailVerified": true, * "privacyStatus": "PUBLIC", * "profile": { * "nickname": "John Doe", * "slug": "johndoe", * "photo": { * "id": "", * "url": "https://example.com/newphoto.jpg", * "height": 0, * "width": 0 * } * }, * "status": "APPROVED" * } * } */
Errors

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

Did this help?