Search.../

getMember( )

Retrieves a member by ID.

Description

This function returns a Promise that resolves to a member object.

Note: The resolved 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.

Syntax

function getMember(id: string, [options: FieldsetOptions]): Promise<Member>

getMember Parameters

NAME
TYPE
DESCRIPTION
id
string

Member ID.

options
Optional
FieldsetOptions

Fieldset options.

Returns

Fulfilled - Retrieved member information.

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?

Get a member by ID

Copy Code
1import { members } from 'wix-members-backend';
2
3// Sample id value:
4// '60a91ab6-5e30-4af2-9d5e-a205c351ffd7'
5//
6// Sample options value:
7// {
8// fieldsets: [ 'FULL' ]
9// }
10
11export const myGetMemberFunction = webMethod(Permissions.Anyone, (id, options) => {
12 return members.getMember(id, options)
13 .then((member) => {
14 const slug = member.profile.slug;
15 const name = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`;
16 const contactId = member.contactId;
17 return member;
18 })
19 .catch((error) => {
20 console.error(error);
21 });
22}
23
24/* Promise resolves to:
25 * {
26 * "_id": "f32cbc51-a331-442b-86c2-2c664613e8b9",
27 * "_createdDate": "2021-08-02T23:14:42.000Z",
28 * "_updatedDate": "2021-08-02T23:14:58.345Z",
29 * "lastLoginDate": "2021-08-02T23:17:29.000Z",
30 * "loginEmail": "claude.morales@example.com",
31 * "status": "APPROVED",
32 * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9",
33 * "privacyStatus": "PUBLIC",
34 * "activityStatus": "ACTIVE",
35 * "contactDetails": {
36 * "firstName": "Claude",
37 * "lastName": "Morales",
38 * "phones": [
39 * "0747-769-460"
40 * ],
41 * "emails": [
42 * "claude.morales@example.com"
43 * ],
44 * "addresses": [
45 * {
46 * "_id": "e151960c-04a7-43ef-aa17-a134916ded07",
47 * "addressLine": "9373 Park Avenue",
48 * "addressLine2": "Berkshire",
49 * "city": "Ely",
50 * "subdivision": "GB-ENG",
51 * "country": "GB",
52 * "postalCode": "PD50 8EU"
53 * }
54 * ],
55 * "customFields": {}
56 * },
57 * "profile": {
58 * "nickname": "claude.morales",
59 * "slug": "claudemorales"
60 * }
61 * }
62 */