Clears a member's email addresses.
The deleteMemberEmails()
function clears the emails
array under the contact
property.
Notes:
A member can still log in with their loginEmail
,
which is not cleared when this function is called.
Only logged-in members can call this function without elevated permissions. To call this function as a different identity, elevated permissions are required.
function deleteMemberEmails(_id: string): Promise<DeleteMemberEmailsResponse>;
ID of the member whose email addresses will be deleted.
import { Permissions, webMethod } from "wix-web-module";
import { members } from "wix-members.v2";
/* Sample _id value: 'f32cbc51-a331-442b-86c2-2c664613e8b9' */
export const myDeleteEmailsFunction = webMethod(Permissions.Anyone, (id) => {
return members
.deleteMemberEmails(id)
.then((updatedMember) => {
const emails = updatedMember.contact.emails;
return updatedMember;
})
.catch((error) => {
console.error(error);
});
});
/* Promise resolves to:
* {
* "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",
* "_createdDate": "2021-08-02T23:14:42.000Z",
* "_updatedDate": "2021-08-02T23:14:58.345Z",
* "lastLoginDate": "2021-08-02T23:17:29.000Z",
* "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",
* "loginEmail": "claude.morales@example.com",
* "loginEmailVerified": true,
* "status": "APPROVED",
* "activityStatus": "ACTIVE",
* "privacyStatus": "PUBLIC",
* "contact": {
* "firstName": "Claude",
* "lastName": "Morales",
* "phones": [
* "0747-769-460"
* ],
* "emails": [],
* "addresses": [
* {
* "_id": "f0f4d905-488d-44db-9080-fc29078cfad5",
* "addressLine": "9373 Park Avenue",
* "addressLine2": "Berkshire",
* "city": "Ely",
* "subdivision": "GB-ENG",
* "country": "GB",
* "postalCode": "PD50 8EU"
* }
* ],
* "customFields": {}
* },
* "profile": {
* "nickname": "Claude Morales",
* "slug": "claudemorales"
* }
* }
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.