[development] deny user #1

Augustin (Beginner) drupal.beginner at wechange.org
Wed Sep 13 14:58:19 UTC 2006


On Wednesday 13 September 2006 10:44 pm, Johan Forngren wrote:
> I've learned that one should never call die/exit, since some functions will
> not be executed then (e.g. footer functions etc).

you're right, but this was a quick test, and die() never got executed anyway.

Anyway, the code below still does not work, because it also prevent user #1 to 
run cron.php which is needed to import the nodes. I'll add another check to 
see the requested URI to allow cron to do its job.


function demexp_form_alter($form_id, &$form) {
  global $user;
  if ($form_id == 'demexp_question_node_form' AND $user->uid == 1) {
    echo $user->uid;
    drupal_set_message( t('You may not create or modify a demexp_question 
node'), 'error');
    drupal_goto('<front>');
  }

It's not that urgent, so I still have time to look for the best solution.

thanks,

Augustin.



-- 
http://www.wechange.org/
Because we and the world need to change.
 
http://www.reuniting.info/
Intimate Relationships, peace and harmony in the couple.


More information about the development mailing list