> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: updateCurrentMemberSlug(slug: string) # Method package: wixMembersV2 # Method menu location: wixMembersV2 --> members --> updateCurrentMemberSlug # Method Link: https://dev.wix.com/docs/velo/apis/wix-members-v2/members/update-current-member-slug.md # Method Description: Updates the currently logged in member's slug. The `slug` is the end of a member's URL that refers to a specific logged-in member. For example, if a member's URL is `https://example.com/member/{my-member-slug}`, the slug is `my-member-slug`. The slug is case-sensitive and is generally derived from the member's `nickname`; otherwise, it's derived from the `loginEmail`. > **Note:** > Only logged-in members can call this function without elevated permissions. > To call this function as a different identity, [elevated permissions](https://www.wix.com/velo/reference/wix-auth/elevate) are required. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Update the currently logged-in member's slug (export from backend code) ```javascript import { members } from 'wix-members.v2'; import { webMethod, Permissions } from 'wix-web-module'; const updateCurrentMemberSlug = members.updateCurrentMemberSlug; /* Sample slug value: * { * "slug": "new-member-slug" * } */ export const myUpdateCurrentMemberSlugFunction = webMethod( Permissions.SiteMember, async (slug) => { try { const member = await updateCurrentMemberSlug(slug); const memberID = members._id; console.log('Updated slug:', member); return member; } catch (error) { console.error(error); // Handle the error } } ); /* Promise resolves to: * { * "_createdDate": "2024-02-22T13:52:00.000Z", * "_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": [ * "john.doe@example.com" * ], * "addresses": [], * "customFields": {} * }, * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12", * "lastLoginDate": "2024-02-29T11:40:21.000Z", * "loginEmail": "john.doe@example.com", * "loginEmailVerified": true, * "privacyStatus": "PUBLIC", * "profile": { * "nickname": "JohnD", * "slug": "new-member-slug", * "photo": { * "url": "https://example.com/new_photo.jpg", * "height": 0, * "width": 0, * "_id": "" * } * }, * "status": "APPROVED" * } */ ``` ## Update the currently logged-in member's slug (Dashboard page code) ```javascript import { members } from 'wix-members.v2'; import { webMethod, Permissions } from 'wix-web-module'; const updateCurrentMemberSlug = members.updateCurrentMemberSlug; /* Sample slug value: * { * "slug": "new-member-slug" * } */ export async function myUpdateCurrentMemberSlugFunction(slug){ try { const member = await updateCurrentMemberSlug(slug); console.log('Updated slug:', member); return member; } catch (error) { console.error(error); // Handle the error } }; /* Promise resolves to: * { * "_createdDate": "2024-02-22T13:52:00.000Z", * "_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": [ * "john.doe@example.com" * ], * "addresses": [], * "customFields": {} * }, * "contactId": "ff20c02e-3d13-4412-9529-d628aa0abc12", * "lastLoginDate": "2024-02-29T11:40:21.000Z", * "loginEmail": "john.doe@example.com", * "loginEmailVerified": true, * "privacyStatus": "PUBLIC", * "profile": { * "nickname": "JohnD", * "slug": "new-member-slug", * "photo": { * "url": "https://example.com/new_photo.jpg", * "height": 0, * "width": 0, * "_id": "" * } * }, * "status": "APPROVED" * } */ ``` ---