Drupal-8-user-register-hook
The most effective way to intercept or modify user data during registration is through the following hooks: Usage Note Runs before the user is saved.
If you need to stop registration based on custom business logic (e.g., checking an external blacklist), use a custom validation handler via hook_form_alter . drupal-8-user-register-hook
To hook into the user registration process in Drupal 8 (and 9/10+), you typically use entity hooks since users are treated as content entities. 🛠️ Recommended Hooks The most effective way to intercept or modify
Inside presave , always call $user->isNew() to ensure your code only runs during initial registration rather than every time a profile is updated. 🛠️ Recommended Hooks Inside presave , always call
Best for modifying data (e.g., adding a default role) before it hits the database. Runs after the user is created.
[Solved] How to hook into Commerce after payment complete - Drupal