Search.../

deleteMemberEmails( )

Clears a member's email addresses.

Description

The deleteMemberEmails() function returns a Promise that resolves to a member object when the specified member's email addresses are cleared.

deleteMemberEmails() deletes all email addresses from the contactDetails.emails array, which affects both the specified member and the attached contact.

Note: The member can still log in with their loginEmail, which is not changed when this function is called.

Syntax

function deleteMemberEmails(id: string): Promise<Member>

deleteMemberEmails Parameters

NAME
TYPE
DESCRIPTION
id
string

ID of the member whose email addresses will be deleted.

Returns

Fulfilled - Updated member. Rejected - Error message.

Return Type:

Promise<Member>
NAME
TYPE
DESCRIPTION
_id
string

Member ID.

loginEmail
string

Email used by the member to log in to the site.

status
string

Member site access status.

One of:

  • "PENDING": Member created and is waiting for approval by site owner.
  • "APPROVED": Member can log in to the site.
  • "OFFLINE": Member is a guest author for the site blog and cannot log in to the site.
  • "BLOCKED": Member is blocked and cannot log in to the site.
  • "UNKNOWN": Insufficient permissions to get the status.
contactId
string

Contact ID.

privacyStatus
string

Member privacy status.

One of:

  • "PUBLIC": Member is visible to everyone.
  • "PRIVATE": Member is hidden from site visitors and other site members. Member is returned only to site contributors and apps with the appropriate permissions.
  • "UNKNOWN": Insufficient permissions to get the status.
activityStatus
string

Member activity status.

One of:

  • "ACTIVE": Member can write forum posts and blog comments.
  • "MUTED": Member cannot write forum posts or blog comments.
  • "UNKNOWN": Insufficient permissions to get the status.
_createdDate
Date

Date and time when the member was created.

_updatedDate
Date

Date and time when the member was updated.

lastLoginDate
Date

Date and time when the member last logged in to the site.

contactDetails
ContactDetails

Member's contact information. Contact information is stored in the Contact List.

profile
Profile

Profile display info.

Was this helpful?

Delete a member's email addresses

Copy Code
1import { members } from 'wix-members-backend';
2
3// Sample id value:
4// 'f32cbc51-a331-442b-86c2-2c664613e8b9'
5
6export const myDeleteEmailsFunction = webMethod(Permissions.Anyone, (id) => {
7 return members.deleteMemberEmails(id)
8 .then((updatedMember) => {
9 const emails = updatedMember.contactDetails.emails;
10 return updatedMember;
11 })
12 .catch((error) => {
13 console.error(error);
14 })
15}
16
17/* 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 * "status": "APPROVED",
26 * "activityStatus": "ACTIVE",
27 * "privacyStatus": "PUBLIC",
28 * "contactDetails": {
29 * "firstName": "Claude",
30 * "lastName": "Morales",
31 * "phones": [
32 * "0747-769-460"
33 * ],
34 * "emails": [],
35 * "addresses": [
36 * {
37 * "_id": "f0f4d905-488d-44db-9080-fc29078cfad5",
38 * "addressLine": "9373 Park Avenue",
39 * "addressLine2": "Berkshire",
40 * "city": "Ely",
41 * "subdivision": "GB-ENG",
42 * "country": "GB",
43 * "postalCode": "PD50 8EU"
44 * }
45 * ],
46 * "customFields": {}
47 * },
48 * "profile": {
49 * "nickname": "Claude Morales",
50 * "slug": "claudemorales"
51 * }
52 * }
53 */