Search.../

getMember( )

Retrieves a member by ID.

Description

Note: The returned Member object contains only the fields that were explicitly 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: GetMemberOptions): Promise<Member>

getMember Parameters

NAME
TYPE
DESCRIPTION
_id
string

Member ID.

options
Optional
GetMemberOptions

Fieldset options.

Returns

The requested member.

Return Type:

Promise<
Member
>
NAME
TYPE
DESCRIPTION
_createdDate
Date

Date and time when the member was created.

_id
string

Member ID.

_updatedDate
Date

Date and time when the member was updated.

activityStatus
string

Member activity status.

  • 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.
contact
Contact

Member's contact information. Contact information is stored in the Contact List.

contactId
string

Contact ID.

lastLoginDate
Date

Date and time when the member last logged in to the site.

loginEmail
string

Email used by the member to log in to the site.

loginEmailVerified
boolean

Whether the email used by the member has been verified.

privacyStatus
string

Member privacy status.

  • 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.
profile
Profile

Profile display info.

status
string

Member site access status.

  • 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.

Was this helpful?

Get a member by ID with minimum parameters (export from backend code)

Copy Code
1import { members } from 'wix-members.v2';
2import { webMethod, Permissions } from 'wix-web-module';
3import { elevate } from 'wix-auth';
4
5/* Sample _id value: '60a91ab6-5e30-4af2-9d5e-a205c351ffd7' */
6
7const elevatedgetMember = elevate(members.getMember);
8
9export const myGetMemberFunction = webMethod(
10 Permissions.Anyone,
11 async (_id, options) => {
12 try {
13 const member = await elevatedgetMember(_id, options);
14 console.log('Member retrieved:', member);
15
16 return member;
17 } catch (error) {
18 console.error(error);
19 // Handle the error
20 }
21 }
22);
23
24/* Promise resolves to:
25 * {
26 * "_createdDate": "2024-02-28T10:42:31.000Z",
27 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",
28 * "_updatedDate": "2024-02-28T10:42:30.891Z",
29 * "activityStatus": "UNKNOWN",
30 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",
31 * "privacyStatus": "UNKNOWN",
32 * "profile": {
33 * "nickname": "johnjonas",
34 * "slug": "johnjonas"
35 * },
36 * "status": "UNKNOWN"
37 * }
38 */
Get a member by ID with all parameters (export from backend code)

Copy Code
1import { members } from 'wix-members.v2';
2import { webMethod, Permissions } from 'wix-web-module';
3import { elevate } from 'wix-auth';
4
5/*
6 * Sample _id value: '60a91ab6-5e30-4af2-9d5e-a205c351ffd7'
7 *
8 * Sample options value:
9 * {
10 * fieldsets: [ 'FULL' ]
11 * }
12 */
13
14const elevatedgetMember = elevate(members.getMember);
15
16export const myGetMemberFunction = webMethod(
17 Permissions.Anyone,
18 async (_id, options) => {
19 try {
20 const member = await elevatedgetMember(_id, options);
21 console.log('Member retrieved:', member);
22
23 return member;
24 } catch (error) {
25 console.error(error);
26 // Handle the error
27 }
28 }
29);
30
31/* Promise resolves to:
32 * {
33 * "_createdDate": "2024-02-28T10:42:31.000Z",
34 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",
35 * "_updatedDate": "2024-02-28T10:42:30.891Z",
36 * "activityStatus": "UNKNOWN",
37 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",
38 * "privacyStatus": "UNKNOWN",
39 * "profile": {
40 * "nickname": "johnjonas",
41 * "slug": "johnjonas"
42 * },
43 * "status": "UNKNOWN"
44 * }
45 */
46
Get a member by ID (dashboard page code)

Copy Code
1import { members } from 'wix-members.v2';
2
3/* Sample _id value: '60a91ab6-5e30-4af2-9d5e-a205c351ffd7' */
4
5export async function myGetMemberFunction(_id, options){
6 try {
7 const member = await members.getMember(_id, options);
8 console.log('Member retrieved:', member);
9
10 return member;
11 } catch (error) {
12 console.error(error);
13 // Handle the error
14 }
15};
16
17/* Promise resolves to:
18 * {
19 * "_createdDate": "2024-02-28T10:42:31.000Z",
20 * "_id": "20aca292-e791-45b4-902f-7e7e22c96dd5",
21 * "_updatedDate": "2024-02-28T10:42:30.891Z",
22 * "activityStatus": "UNKNOWN",
23 * "contactId": "20aca292-e791-45b4-902f-7e7e22c96dd5",
24 * "privacyStatus": "UNKNOWN",
25 * "profile": {
26 * "nickname": "johnjonas",
27 * "slug": "johnjonas"
28 * },
29 * "status": "UNKNOWN"
30 * }
31 */