Our current setup involves a multisite for different parts of our company. We need all sites to share a single user pool for various reason, but each site has slightly different user profile regulations that we need to adhere to. We have different permissions for profile fields on each site, so I need to prevent user profiles being saved if a user isn't on their home site.
I have a field in every profile called "Domain". I intend on pairing this to the current site url to determine if the user is on their home site or not. If not, I need to stop all user_saves from completing. What would be the best way of going about this?
I've found in D6 hook_validate('user') would have done the trick, but there doesn't seem to be anything in D7 that I can use. Would hook_presave work, if I throw an exception?
hook_presave()
, I wondered what happened when you try it (surreptitiously trying to get you to notice that there's no such hook).hook_entity_presave()
is probably what you're looking for, I can't speak to whether or not throwing an exception in an implementation of that hook will cause a problem, I haven't seen it tried before