Search.../

onMemberCreated( )

An event that is triggered when a site member is created.

Description

The onMemberCreated() event handler runs when a site member is created. The received CreatedMemberEvent object contains information about the site member that was created.

The site owner can configure the site to automatically approve members or require manual approval. A member who has been approved either automatically or manually has a status of APPROVED. A created member waiting for approval has a status of PENDING. A PENDING member cannot log into the site.

Note: Backend events don’t work when previewing your site.

Syntax

function onMemberCreated(event: CreatedMemberEvent): void

onMemberCreated Parameters

NAME
TYPE
DESCRIPTION
event
CreatedMemberEvent

Information about the member that was created.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

An event that occurs when a site member is created

Copy Code
1// Place this code in the events.js file
2// of your site's Backend section.
3// Add the file if it doesn't exist.
4
5export function wixMembers_onMemberCreated(event) {
6 const memberNickname = event.entity.profile.nickname;
7 const creationEventId = event.metadata.id;
8}
9
10/* Full event object:
11 * {
12 * "metadata": {
13 * "id": "b91e0e4e-1869-4705-ae8c-70b456b2ceed",
14 * "entityId": "583b58eb-708e-4eba-bb8d-af7f9914721b",
15 * "eventTime": "2021-12-10T15:00:29.236054Z",
16 * "triggeredByAnonymizeRequest": false
17 * },
18 * "entity": {
19 * "loginEmail": "john@example.com",
20 * "privacyStatus": "PUBLIC",
21 * "_id": "583b58eb-708e-4eba-bb8d-af7f9914721b",
22 * "_createdDate": "2021-12-10T10:44:37.000Z",
23 * "_updatedDate": "2021-12-10T10:44:36.939Z",
24 * "activityStatus": "ACTIVE",
25 * "profile": {
26 * "profilePhoto": {
27 * "_id": "a27d24_0dd318%7Emv2.jpg",
28 * "url": "http://static.wixstatic.com/media/a27d24_0dd318%7Emv2.jpg",
29 * "height": 0,
30 * "width": 0
31 * },
32 * "slug": "john40355",
33 * "coverPhoto": {
34 * "_id": "",
35 * "url": "https://example.com/myimage.jpg",
36 * "height": 0,
37 * "width": 0
38 * },
39 * "title": "Awesome title",
40 * "nickname": "John Doe"
41 * },
42 * "status": "APPROVED",
43 * "contactId": "583b58eb-708e-4eba-bb8d-af7f9914721b",
44 * "contactDetails": {
45 * "customFields": {
46 * "custom.pet-name": {
47 * "name": "Pet Name",
48 * "value": "Bob"
49 * }
50 * },
51 * "company": "Wix",
52 * "phones": [],
53 * "lastName": "Doe",
54 * "firstName": "John",
55 * "birthdate": "2000-01-01",
56 * "jobTitle": "Developer",
57 * "emails": [
58 * "john@example.com"
59 * ],
60 * "addresses": [
61 * {
62 * "city": "Jewell",
63 * "addressLine": "10 Cedarstone Drive",
64 * "_id": "156e50e8-8127-4617-a052-da66bb9a96a0",
65 * "country": "US",
66 * "postalCode": "43530",
67 * "subdivision": "US-OH"
68 * }
69 * ]
70 * }
71 * }
72 *}
73 */