gets fired in case the user updates his profile, that is also when he reset the first time his password after registration and when he register.
How do I distinguish between the three cases?
EDIT: There are, at least, 3 cases to distinguish, in which that hook is called.
- user's first registration step
- The user fills email and username and save (profile_update gets called here), being presented the request to check email for the verification process
- user reset password after registration
- The user checks his mail, follow the suggested url, reset the password and save (profile_update gets called here)
- user updates his profile
- The user log in and update some data within his profile and save (profile_update gets called here)
I think it is possible to distinguish case 3, verifying if someone his currently logged in calling
Still there is the problem to distinguish case 2 from 1. As s_ha_dum points out there is the possibility to check the user_activation_key. If the key is created not at the time 1 but a time 2, the 3 cases are distinguishable. (Even if I personally believe the hook covers too much cases and shouldn't).