PelcroUserUpdated

Fired when user profile is updated

Overview

Fired when a user's profile information is updated. This event is more specific than PelcroUserLoaded - it only fires when profile data actually changes.


Triggered By

MethodDescription
Pelcro.user.update()Updating profile information
Pelcro.user.uploadProfilePicture()Uploading profile photo
Pelcro.user.removeProfilePicture()Removing profile photo
Pelcro.user.verifyEmailToken()After email verification
Pelcro.user.verifyLoginToken()After passwordless login
Pelcro.user.resendEmailVerification()After resending verification

Event Detail

The event.detail object contains the updated user:

PropertyTypeDescription
idnumberUser's unique identifier
emailstringUser's email address
first_namestringUser's first name
last_namestringUser's last name
phonestringUser's phone number
profile_photostringURL to profile photo
email_verifiedbooleanWhether email is verified

Example

document.addEventListener('PelcroUserUpdated', (event) => {
  const user = event.detail;

  console.log(`Profile updated for: ${user.email}`);

  // Update UI with new data
  updateProfileDisplay({
    name: `${user.first_name} ${user.last_name}`,
    avatar: user.profile_photo
  });

  // Track update
  analytics.track('Profile Updated', {
    userId: user.id
  });
});

Related