updateMember( )
Updates a member's properties.
Description
The updateMember()
function returns a Promise that resolves to a member object
when the specified member is updated.
Note: The updated Member object contains only the fields that were explicity added to the Member object. Custom Contact fields are not automatically added to the Member object. They must be added to the Member object by the site owner.
Only the requested fields are updated.
Note: Updating the
contactDetails.addresses
,contactDetails.emails
, orcontactDetails.phones
array overwrites the entire array, so any existing values you want to retain must be passed in theupdateMember()
call along with the new values to add.However, passing an empty array will have no effect, and these functions must be used to clear all data from the respective array:
- To clear
contactDetails.addresses
, usedeleteMemberAddresses()
.- To clear
contactDetails.emails
, usedeleteMemberEmails()
.- To clear
contactDetails.phones
, usedeleteMemberPhones()
.
Syntax
function updateMember(id: string, member: MemberInfo): Promise<Member>
updateMember Parameters
NAME
TYPE
DESCRIPTION
Member ID.
Member details to update.
Returns
Fulfilled - Updated member. Rejected - Error message.
Return Type:
NAME
TYPE
DESCRIPTION
Member ID.
Email used by the member to log in to the site.
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.
Contact ID.
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.
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.
Date and time when the member was created.
Date and time when the member was updated.
Date and time when the member last logged in to the site.
Member's contact information. Contact information is stored in the Contact List.
Profile display info.
Was this helpful?
Overwrite a member's email addresses
1import { members } from 'wix-members-backend';23// Sample id value:4// 'f32cbc51-a331-442b-86c2-2c664613e8b9'5//6// Sample member value:7// {8// contactDetails: {9// emails: ['claudes.new.email@example.com']10// }11// }1213export const myUpdateMemberFunction = webMethod(Permissions.Anyone, (id, member) => {14 return members.updateMember(id, member)15 .then((member) => {16 return member;17 })18 .catch((error) => {19 console.error(error);20 });21}2223/* Promise resolves to:24 * {25 * "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",26 * "_createdDate": "2021-08-02T23:14:42.000Z",27 * "_updatedDate": "2021-08-02T23:14:58.345Z",28 * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",29 * "activityStatus": "UNKNOWN",30 * "privacyStatus": "UNKNOWN",31 * "status": "UNKNOWN",32 * "contactDetails": {33 * "firstName": "Claude",34 * "lastName": "Morales",35 * "phones": [36 * "0747-769-460"37 * ],38 * "emails": [39 * "claudes.new.email@example.com"40 * ],41 * "addresses": [42 * {43 * "_id": "e151960c-04a7-43ef-aa17-a134916ded07",44 * "addressLine": "9373 Park Avenue",45 * "addressLine2": "Berkshire",46 * "city": "Ely",47 * "subdivision": "GB-ENG",48 * "country": "GB",49 * "postalCode": "PD50 8EU"50 * },51 * {52 * "_id": "88a6f2ed-83d5-435d-ab55-4af1cb1b7861",53 * "country": "IE"54 * }55 * ],56 * "customFields": {57 * "someKey": {58 * "value": "someValue"59 * }60 * }61 * },62 * "profile": {63 * "nickname": "Claude Morales",64 * "slug": "claudemorales"65 * }66 * }67*/