When a new user is created, either via admin or by normal user registration, I need to assign a custom role to that user. It works fine, but I'm not convinced I've checked the user status enough.
In my hook_user_presave() implementation, I check to make sure the administration role isn't set, and uid isn't 1. To set my role:
if ($account->uid == 1 || array_search('administrator', $account->roles)) return; $account->roles = 'my_custom_role';
I only want to do this if it is a brand new user being created/inserted. The documentation says hook_user_presave() is called if the user is being updated. What is the best way to check if this is a brand new user creation? Would uid be set to 0?