leaveCommunity( )


Removes the currently logged-in member from the site community and sets their profile to private.

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

Notes:

  • If a member leaves the site's community, their content (such as forum posts and blog comments) remain publicly visible.
  • 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 leaveCommunity(): Promise<LeaveCommunityResponse>;
Request
This method does not take any parameters
Returns
Return Type:Promise<LeaveCommunityResponse>
JavaScript
import { members } from "wix-members.v2"; import { webMethod, Permissions } from "wix-web-module"; export const myLeaveCommunityFunction = webMethod( Permissions.SiteMember, async () => { try { const member = await members.joinCommunity(); console.log("Member removed from 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?