What is the hook to alter the form that appears for the URL admin/people/create?

I tried hook_form_alter(), but that's not the right one.

  • I think you made a mistake somewhere, I can't think of a reason why hook_form_alter wouldn't work for that particular form. – marcvangend Dec 26 '11 at 18:45

 * Implements hook_form_alter().
function mymodule_form_alter(&$form, &$form_state, $form_id) {
  switch($form_id) {
    case "user_register_form" :
      //Your Logic

But for performance issue use hook_form_FORM_ID_alter()

  • 2
    For future readers: The implementation of hook_form_FORM_ID_alter() for user_register_form would be hook_form_user_register_form_alter(). – kiamlaluno Jan 8 '13 at 10:51
function modulename_form_user_register_form_alter(&$form) {
  // modify $form var

hook_form_FORM_ID_alter() API Docs

  • 2
    The complete list of parameters would be &$form, &$form_state, $form_id; if the function is just using the first parameter (as it normally happen), it can short the parameter list to only that parameter. – kiamlaluno Jan 8 '13 at 10:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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