Hello there,
I'm new to Drupal, just started a couple of weeks ago. I had following queries regarding hooks. It would be great if someone could provide feedback/suggestions on this.
1. I have written a module which implements "hook_user" and handles "update" and "insert" operations. I want to be able to signal failure/ success from this function. For e.g. if I return failure (boolean FALSE) from "hook_user" for "update" operation, then user update should not happen. I want to do this for "insert", "update" and "delete" operations.
* Is it possible to indicate failure in this way so that update/ insert/ delete will not take place?
* If yes, how can I accomplish this?
2. Also, I quickly glanced through the user.module. At the top there is a function called "user_module_invoke" which takes care of invoking "hook_user" in various modules. But it does not check for return value, nor does it return anything. So probably result of invoking a hook_user is never checked.
If Drupal hooks currently don't check for return value, would it be good idea to add such a functionality? A "pre-operation" hook, which will indicate (boolean TRUE/ FALSE) if the operation should continue or not. Such a hook could be used for various validations when Drupal is integrated with some third-party applications. Any takers for this?
Do reply.
Thanks in anticipation,
Pushyamitra