[development] Can I Indicate failure from hook_user?

John Fiala jcfiala at gmail.com
Tue Jul 22 15:31:56 UTC 2008


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.

On Tue, Jul 22, 2008 at 8:48 AM, Pushyamitra Navare
<pushyamitra at gmail.com> wrote:
> On Tue, Jul 22, 2008 at 7:15 PM, Earnie Boyd
> <earnie at users.sourceforge.net> wrote:
>> Well that isn't too friendly.  If you don't want the user to be deleted you
>> could use a hook_form_alter to hide or remove the button.
>>
>
> Well, ideally I would like the pre-user-delete-validate function to be
> called for every user. If I disable button etc. through
> hook_form_alter, then either all users will be deleted or none. I
> won't be able to validate individual users and decide to delete or not
> delete that user.
>
> I actually ended up modifying user.module code and calling my own
> validate function just before deleting user. Based on validate
> function's result I either delete the user or just register error. (
> The obvious pain would arise when I wish to upgrade to newer Drupal
> version in future. I would have patch the new user.module as wel. ).
> For now, it's working...
>
>
> Pushya
>



-- 
John Fiala


More information about the development mailing list