Deprecated. This event will continue to work, but a newer version is available at onMemberCreated().
An event that is triggered when a site member is created.
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.
function onMemberCreated(event: CreatedMemberEvent): void;
Information about the member that was created.
This example uses a deprecated event.
// Place this code in the events.js file
// of your site's Backend section.
// Add the file if it doesn't exist.
export function wixMembers_onMemberCreated(event) {
const memberNickname = event.entity.profile.nickname;
const creationEventId = event.metadata.id;
}
/* Full event object:
* {
* "metadata": {
* "id": "b91e0e4e-1869-4705-ae8c-70b456b2ceed",
* "entityId": "583b58eb-708e-4eba-bb8d-af7f9914721b",
* "eventTime": "2021-12-10T15:00:29.236054Z",
* "triggeredByAnonymizeRequest": false
* },
* "entity": {
* "loginEmail": "john@example.com",
* "privacyStatus": "PUBLIC",
* "_id": "583b58eb-708e-4eba-bb8d-af7f9914721b",
* "_createdDate": "2021-12-10T10:44:37.000Z",
* "_updatedDate": "2021-12-10T10:44:36.939Z",
* "activityStatus": "ACTIVE",
* "profile": {
* "profilePhoto": {
* "_id": "a27d24_0dd318%7Emv2.jpg",
* "url": "http://static.wixstatic.com/media/a27d24_0dd318%7Emv2.jpg",
* "height": 0,
* "width": 0
* },
* "slug": "john40355",
* "coverPhoto": {
* "_id": "",
* "url": "https://example.com/myimage.jpg",
* "height": 0,
* "width": 0
* },
* "title": "Awesome title",
* "nickname": "John Doe"
* },
* "status": "APPROVED",
* "contactId": "583b58eb-708e-4eba-bb8d-af7f9914721b",
* "contactDetails": {
* "customFields": {
* "custom.pet-name": {
* "name": "Pet Name",
* "value": "Bob"
* }
* },
* "company": "Wix",
* "phones": [],
* "lastName": "Doe",
* "firstName": "John",
* "birthdate": "2000-01-01",
* "jobTitle": "Developer",
* "emails": [
* "john@example.com"
* ],
* "addresses": [
* {
* "city": "Jewell",
* "addressLine": "10 Cedarstone Drive",
* "_id": "156e50e8-8127-4617-a052-da66bb9a96a0",
* "country": "US",
* "postalCode": "43530",
* "subdivision": "US-OH"
* }
* ]
* }
* }
*}
*/
This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.