Search...
deleteMemberPhones( )
Clears a member's phone numbers.
Description
The deleteMemberPhones()
function clears the phones
array under the contact
property.
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 deleteMemberPhones(_id: string): Promise<DeleteMemberPhonesResponse>
deleteMemberPhones Parameters
NAME
TYPE
DESCRIPTION
_id
string
ID of the member whose phone numbers will be deleted.
Returns
Return Type:
Promise<
DeleteMemberPhonesResponse
>NAME
TYPE
DESCRIPTION
member
Member
Updated member.
Was this helpful?
Delete a member's phone numbers (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 myDeletePhonesFunction = webMethod(Permissions.Anyone, (id) => {7 return members.deleteMemberPhones(id)8 .then((updatedMember) => {9 const phones = updatedMember.contact.phones;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 * "emails": [34 * "claude.morales@example.com"35 * ],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 phone numbers 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 elevatedDeleteMemberPhones = elevate(members.deleteMemberPhones);67/* Sample _id value: '20aca292-e791-45b4-902f-7e7e22c96dd5' */89export const myDeleteMemberPhones = webMethod(10 Permissions.Anyone,11 async (_id) => {12 try {13 const member = await elevatedDeleteMemberPhones(_id);14 console.log('Deleted members phone: ', member);1516 return member;17 } catch (error) {18 console.error(error);19 // Handle the error20 }21 }22);2324/* Promise resolves to:25 *26 * {27 * "_createdDate": "2024-02-28T10:42:31.000Z",28 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",29 * "_updatedDate": "2024-02-28T10:42:30.891Z",30 * "activityStatus": "ACTIVE",31 * "contact": {32 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",33 * "firstName": "John",34 * "lastName": "Jonas",35 * "phones": [],36 * "emails": [],37 * "addresses": [],38 * "customFields": {}39 * },40 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",41 * "lastLoginDate": "2024-02-28T10:42:31.000Z",42 * "loginEmail": "johnjonas@gmail.com",43 * "loginEmailVerified": false,44 * "privacyStatus": "PRIVATE",45 * "profile": {46 * "nickname": "johnjonas",47 * "slug": "johnjonas"48 * },49 * "status": "APPROVED"50 * }51 *52 */
Delete a member's phone numbers (dashboard page code)
Copy Code
1import { members } from 'wix-members.v2';23/* Sample _id value: '20aca292-e791-45b4-902f-7e7e22c96dd5' */45export async function myDeleteMemberPhones(_id){6 try {7 const member = await members.deleteMemberPhones(_id);8 console.log('Deleted members phone: ', member);910 return member;11 } catch (error) {12 console.error(error);13 // Handle the error14 }15};1617/* Promise resolves to:18 *19 * {20 * "_createdDate": "2024-02-28T10:42:31.000Z",21 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",22 * "_updatedDate": "2024-02-28T10:42:30.891Z",23 * "activityStatus": "ACTIVE",24 * "contact": {25 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",26 * "firstName": "John",27 * "lastName": "Jonas",28 * "phones": [],29 * "emails": [],30 * "addresses": [],31 * "customFields": {}32 * },33 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",34 * "lastLoginDate": "2024-02-28T10:42:31.000Z",35 * "loginEmail": "johnjonas@gmail.com",36 * "loginEmailVerified": false,37 * "privacyStatus": "PRIVATE",38 * "profile": {39 * "nickname": "johnjonas",40 * "slug": "johnjonas"41 * },42 * "status": "APPROVED"43 * }44 *45 */