Following is my .module file code
/**
* Implements hook_user_presave().
*/
function cost_sheet_user_presave($account) {
$source_userid = $account->id();
\Drupal::messenger()->addMessage(t($source_userid));
}
This is giving me uid for already existing users when edited but not printing any value when a new user is created. How to get uid of newly created user in drupal 8 user presave hook?
$account->isNew()
hook_entity_postsave()
instead