I'm looking to alter user_registration behavior to allow certain users to reopen their closed or blocked accounts but not users who have been explicitly banned. As such, I'm looking to modify the current form element for ['account']['status'] from just allowing 'Blocked' and 'Active' to something like this

$form['account']['status']['#options'] = array(t('Blocked'), t('Active'), t('Banned/Dead to Me'));

This is an easy form_alter hook to execute and Drupal will add the new value ('2') in the users table but it doesn't know what to do with it in other functions, ex. on the admin/people page, it doesn't recognize the new value:

Notice: Undefined index: 2 in user_admin_account() (line 226 of /public/modules/user/user.admin.inc).

Is there another way to customize the user status options or is this a protected core value? Are there already modules that add new user status options that I could look at as a model?

  • are you opposed to adding a "banned" field to the account fields? You could leave Blocked/Active as they are, and check for the banned field value to truly ban someone.
    – jdu
    Jul 30, 2013 at 20:57
  • not opposed - thats definitely the next best course of action if we can't get this to work. I'm working through trying to see if we can resolve these errors through other drupally hooks but wanted to confirm whether or not there was a better way of doing this or if anyone else had attempted this.
    – schnippy
    Aug 1, 2013 at 18:57

1 Answer 1


Finished working through the implications of this and have confirmed it is not possible to alter the user_status fields through Drupal without causing other complications through other modules -- the 0/1 logic for users is too ingrained in core to overcome.

I've addressed the requirement through a number of other Drupal hooks that work alongside the user module, will be releasing user_reopen module shortly to community.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.