Search...
onMemberCreated( )
Triggered when a member is created.
Description
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.
Syntax
function wixMembers_onMemberCreated(event: MemberCreated): void
onMemberCreated Parameters
NAME
TYPE
DESCRIPTION
event
Optional
MemberCreated
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 file2// of your site's Backend section.3// Add the file if it doesn't exist.45export function wixMembers_onMemberCreated(event) {6 const memberNickname = event.entity.profile.nickname;7 const creationEventId = event.metadata.id;8 const memberId = event.entity._id;910 console.log(`Member with member ID: ${memberId} created.`);11}1213/* Full event object:14 * {15 * "metadata": {16 * "id": "b91e0e4e-1869-4705-ae8c-70b456b2ceed",17 * "entityId": "583b58eb-708e-4eba-bb8d-af7f9914721b",18 * "eventTime": "2021-12-10T15:00:29.236054Z",19 * "triggeredByAnonymizeRequest": false20 * },21 * "entity": {22 * "loginEmail": "john@example.com",23 * "privacyStatus": "PUBLIC",24 * "_id": "583b58eb-708e-4eba-bb8d-af7f9914721b",25 * "_createdDate": "2021-12-10T10:44:37.000Z",26 * "_updatedDate": "2021-12-10T10:44:36.939Z",27 * "activityStatus": "ACTIVE",28 * "profile": {29 * "profilePhoto": {30 * "_id": "a27d24_0dd318%7Emv2.jpg",31 * "url": "http://static.wixstatic.com/media/a27d24_0dd318%7Emv2.jpg",32 * "height": 0,33 * "width": 034 * },35 * "slug": "john40355",36 * "coverPhoto": {37 * "_id": "",38 * "url": "https://example.com/myimage.jpg",39 * "height": 0,40 * "width": 041 * },42 * "title": "Awesome title",43 * "nickname": "John Doe"44 * },45 * "status": "APPROVED",46 * "contactId": "583b58eb-708e-4eba-bb8d-af7f9914721b",47 * "contactDetails": {48 * "customFields": {49 * "custom.pet-name": {50 * "name": "Pet Name",51 * "value": "Bob"52 * }53 * },54 * "company": "Wix",55 * "phones": [],56 * "lastName": "Doe",57 * "firstName": "John",58 * "birthdate": "2000-01-01",59 * "jobTitle": "Developer",60 * "emails": [61 * "john@example.com"62 * ],63 * "addresses": [64 * {65 * "city": "Jewell",66 * "addressLine": "10 Cedarstone Drive",67 * "_id": "156e50e8-8127-4617-a052-da66bb9a96a0",68 * "country": "US",69 * "postalCode": "43530",70 * "subdivision": "US-OH"71 * }72 * ]73 * }74 * }75 *}76 */