[development] Can I Indicate failure from hook_user?

Earnie Boyd earnie at users.sourceforge.net
Wed Jul 23 18:57:17 UTC 2008


Quoting Pushyamitra Navare <pushyamitra at gmail.com>:

> On Tue, Jul 22, 2008 at 9:01 PM, John Fiala <jcfiala at gmail.com> wrote:
>> Well, one option - I'm not sure how easy it is, because I don't know
>> if you're talking Drupal 5 or Drupal 6 - would be to find all the
>> forms that would try to delete a user via user_delete, and change the
>> validation of those forms using hook_form_alter to call your
>> validation function before the submit comes along and does a
>> user_delete on them.  That wouldn't require hacking core.
>
> Thanks John. I am using Drupal 6.2.
>
> I am sure what you say will work, and I will be able to change
> validate handler though form_alter, and validate hook will be called
> before user is deleted. Only problem I guess is that: it will be
> called only once even if multiple users are being deleted ('coz it's
> form validate handler, not user delete handler). Right?
>
> If possible, I wanted my validate function to be called for individual
> user, and delete/not delete user based on errors returned by validate
> hook.
>

Your module can modify the value for the MENU_CALLBACK item to action a 
different function which will eventually call the appropriate _submit 
hook.

Earnie -- http://for-my-kids.com/
-- http://give-me-an-offer.com/



More information about the development mailing list