Search...
deleteMemberEmails( )
Clears a member's email addresses.
Description
The deleteMemberEmails()
function clears the emails
array under the contact
property.
Note: A member can still log in with their
loginEmail
, which is not cleared when this function is called.
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 deleteMemberEmails(_id: string): Promise<DeleteMemberEmailsResponse>
deleteMemberEmails Parameters
NAME
TYPE
DESCRIPTION
_id
string
ID of the member whose email addresses will be deleted.
Returns
Return Type:
Promise<
DeleteMemberEmailsResponse
>NAME
TYPE
DESCRIPTION
member
Member
Updated member.
Was this helpful?
Delete a member's email (export from backend code)
Copy Code
1import { Permissions, webMethod } from 'wix-web-module';2import { members } from 'wix-members.v2';34/* Sample _id value: 'f32cbc51-a331-442b-86c2-2c664613e8b9' */56export const myDeleteEmailsFunction = webMethod(Permissions.Anyone, (id) => {7 return members.deleteMemberEmails(id)8 .then((updatedMember) => {9 const emails = updatedMember.contact.emails;10 return updatedMember;11 })12 .catch((error) => {13 console.error(error);14 })15});1617/* Promise resolves to:18 * {19 * "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",20 * "_createdDate": "2021-08-02T23:14:42.000Z",21 * "_updatedDate": "2021-08-02T23:14:58.345Z",22 * "lastLoginDate": "2021-08-02T23:17:29.000Z",23 * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",24 * "loginEmail": "claude.morales@example.com",25 * "loginEmailVerified": true,26 * "status": "APPROVED",27 * "activityStatus": "ACTIVE",28 * "privacyStatus": "PUBLIC",29 * "contact": {30 * "firstName": "Claude",31 * "lastName": "Morales",32 * "phones": [33 * "0747-769-460"34 * ],35 * "emails": [],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 */55
Delete a member's email with elevated permissions (export from backend code)
Copy Code
1import { members } from 'wix-members.v2';2import { webMethod, Permissions } from 'wix-web-module';3import { elevate } from 'wix-auth';45const elevatedDeleteMemberEmails = elevate(members.deleteMemberEmails);67/* Sample _id value: '20aca292-e791-45b4-902f-7e7e22c96dd5' */89export const myDeleteMemberEmailsFunction = webMethod(10 Permissions.Anyone,11 async (_id) => {12 try {13 const member = await elevatedDeleteMemberEmails(_id);14 console.log('Deleted members email: ', member);1516 return member;17 } catch (error) {18 console.error(error);19 // Handle the error20 }21 }22);2324/* Promise resolves to:25 * "member": {26 * "_createdDate": "2024-02-28T10:42:31.000Z",27 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",28 * "_updatedDate": "2024-02-28T10:42:30.891Z",29 * "activityStatus": "ACTIVE",30 * "contact": {31 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",32 * "firstName": "John",33 * "lastName": "Jonas",34 * "phones": [35 * "6 52894975"36 * ],37 * "emails": [],38 * "addresses": [],39 * "customFields": {}40 * },41 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",42 * "lastLoginDate": "2024-02-28T10:42:31.000Z",43 * "loginEmail": "johnjonas@gmail.com",44 * "loginEmailVerified": false,45 * "privacyStatus": "PRIVATE",46 * "profile": {47 * "nickname": "johnjonas",48 * "slug": "johnjonas"49 * },50 * "status": "APPROVED"51 * }52 * }53 */
Delete a member's email (Dashboard page code)
Copy Code
1import { members } from 'wix-members.v2';23/* Sample _id value: 'f32cbc51-a331-442b-86c2-2c664613e8b9' */45export async function myDeleteEmailsFunction(_id) {6 try {7 const member = await members.deleteMemberEmails(_id);8 console.log('Deleted members email: ', member);910 return member;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15}1617/* Promise resolves to:18 * {19 * "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",20 * "_createdDate": "2021-08-02T23:14:42.000Z",21 * "_updatedDate": "2021-08-02T23:14:58.345Z",22 * "lastLoginDate": "2021-08-02T23:17:29.000Z",23 * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",24 * "loginEmail": "claude.morales@example.com",25 * "loginEmailVerified": true,26 * "status": "APPROVED",27 * "activityStatus": "ACTIVE",28 * "privacyStatus": "PUBLIC",29 * "contact": {30 * "firstName": "Claude",31 * "lastName": "Morales",32 * "phones": [33 * "0747-769-460"34 * ],35 * "emails": [],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 */55