getMember( )


Deprecated. This function will continue to work, but a newer version is available at getMember().

Retrieves a member by ID.

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.

Migration Instructions

If this function is already in your code, it will continue to work. To stay compatible with future changes, migrate to getMember().

To migrate to the new function:

  1. Add the new import statement:

    Copy
    import { members } from "wix-members.v2";
  2. Test your changes to make sure your code behaves as expected.

Method Declaration
Copy
function getMember(id: string, options: FieldsetOptions): Promise<Member>;
Method Parameters
idstringRequired

Member ID.


optionsFieldsetOptions

Fieldset options.

Returns
Return Type:Promise<Member>
Get a member by ID

This example uses a deprecated function.

JavaScript
import { Permissions, webMethod } from "wix-web-module"; import { members } from "wix-members-backend"; // Sample id value: // '60a91ab6-5e30-4af2-9d5e-a205c351ffd7' // // Sample options value: // { // fieldsets: [ 'FULL' ] // } export const myGetMemberFunction = webMethod( Permissions.Anyone, (id, options) => { return members .getMember(id, options) .then((member) => { const slug = member.profile.slug; const name = `${member.contactDetails.firstName} ${member.contactDetails.lastName}`; const contactId = member.contactId; return member; }) .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", * "loginEmail": "claude.morales@example.com", * "status": "APPROVED", * "contactId": "f32cbc51-a331-442b-86c2-2c664613e8b9", * "privacyStatus": "PUBLIC", * "activityStatus": "ACTIVE", * "contactDetails": { * "firstName": "Claude", * "lastName": "Morales", * "phones": [ * "0747-769-460" * ], * "emails": [ * "claude.morales@example.com" * ], * "addresses": [ * { * "_id": "e151960c-04a7-43ef-aa17-a134916ded07", * "addressLine": "9373 Park Avenue", * "addressLine2": "Berkshire", * "city": "Ely", * "subdivision": "GB-ENG", * "country": "GB", * "postalCode": "PD50 8EU" * } * ], * "customFields": {} * }, * "profile": { * "nickname": "claude.morales", * "slug": "claudemorales" * } * } */
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?