Add roles to user during create and save account I want to add a custom role to a user during hook_user_create() and hook_user_update(). All goes well during user create, as long as I do $user->save() in the end. The site crashes during hook_user_update() if I do $user->save(). No role is added if I simply add the role with $user->addRole('role_name'), but don't save it. 

This is for Drupal 8.

What am I doing wrong?
Found the answer: hook_user_presave() will do the trick.

I.e you add what you want to the user object (and don't save). Drupal will do the rest.