Update user email after creation

I’m trying to update the user email after the user has been created (because I don’t need and want to store user emails for this particular project) and I thought about using the user.create:after hook to update the current user email.

Apparently that doesn’t seem to work.

I’m doing the following

'user.create:after' => function($user) {

    if ($user->role() != 'supporter')

    $user->update(['email' => 'email@email.com']);

Any reason why this isn’t working? The update itself is working if I try to update something else (like the user name for example).

The user email has to be unique.

Note that you can run into issues trying to log in users with their user name as there’s nothing that tests if the username is unique (unless you implement a check yourself).

O yeah I’m aware of that. I’m planning to simply hash the email and generate a fake email that’s something like hash@somesite.com.

But the hook doesn’t seem to work :thinking:
I’m probably doing something wrong but I don’t know what.

The user email has to be unique.

I’m testing with a unique email.

Hm, yes, I can confirm it doesn’t work. But I don’t know why. Maybe a bug?