Deprecated. This function will continue to work, but a newer version is available at deleteMemberEmails().
Deletes a member's street addresses. Clears a member's email addresses.
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.
If this function is already in your code, it will continue to work. To stay compatible with future changes, migrate to deleteMemberEmails().
To migrate to the new function:
Add the new import statement:
import { members } from "wix-members.v2";
Test your changes to make sure your code behaves as expected.
function deleteMemberEmails(id: string): Promise<Member>;
ID of the member whose email addresses will be deleted.
This example uses a deprecated function.
import { Permissions, webMethod } from "wix-web-module";
import { members } from "wix-members-backend";
// Sample id value:
// 'f32cbc51-a331-442b-86c2-2c664613e8b9'
export const myDeleteEmailsFunction = webMethod(Permissions.Anyone, (id) => {
return members
.deleteMemberEmails(id)
.then((updatedMember) => {
const emails = updatedMember.contactDetails.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",
* "status": "APPROVED",
* "activityStatus": "ACTIVE",
* "privacyStatus": "PUBLIC",
* "contactDetails": {
* "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.