[development] deny user #1

Johan Forngren johan at forngren.com
Wed Sep 13 14:44:27 UTC 2006


I've learned that one should never call die/exit, since some functions will
not be executed then (e.g. footer functions etc).

2006/9/13, Augustin (Beginner) <drupal.beginner at wechange.org>:
>
> On Wednesday 13 September 2006 08:53 pm, Gerhard Killesreiter wrote:
> > Augustin (Beginner) wrote:
> > > On Wednesday 13 September 2006 08:24 pm, Gerhard Killesreiter wrote:
> > >> A brute force method is to unset the form and redirect elsewhere in
> > >> hook_form_alter if you are processing your node form and uid == 1.
> > >
> > > thanks Gerhard,
> > > I'll try that.
> >
> > You'll also need to exit() after the redirect or the form would still be
> > generated, IIRC.
>
> Apparently, it's not necessary. I did the quick test below, and die()
> doesn't
> get executed, but if I add a drupal_set_message() to the redirect, then I
> have something that is good enough for my purposes.
>
> function demexp_form_alter($form_id, &$form) {
>   if ($form_id == 'demexp_question_node_form') {
>     drupal_goto('<front>');
>     die('forbidden');
>   }
> }
>
> thanks,
>
> A.
>
>
> --
> http://www.wechange.org/
> Because we and the world need to change.
>
> http://www.reuniting.info/
> Intimate Relationships, peace and harmony in the couple.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20060913/7f0a31e0/attachment.htm


More information about the development mailing list