Drupal-8-user-register-hook Here

Use this for actions that require the new User ID, like sending a custom welcome email or creating related profile entries. Modifies the registration form .

use Drupal\user\UserInterface; /** * Implements hook_ENTITY_TYPE_presave() for user entities. */ function my_module_user_presave(UserInterface $user) { // Check if this is a new user registration if ($user->isNew()) { // Perform custom logic, e.g., set a field value $user->set('field_welcome_status', 'Pending'); } } Use code with caution. Copied to clipboard 🎯 Key Considerations drupal-8-user-register-hook

[Solved] How to hook into Commerce after payment complete - Drupal Use this for actions that require the new

Inside presave , always call $user->isNew() to ensure your code only runs during initial registration rather than every time a profile is updated. set a field value $user->set('field_welcome_status'