drupal_get_form builds the right form, but fields are missing

zbricoleur - May 12, 2009 - 15:14

So, I'm trying to produce the Request New Password form on a page other than user/password, with the code below. It works, to the extent that a form does get built, with the expected ID. However, the form only contains the two hidden fields, form_id and form_build_id. No field for the username appears. What might I be doing wrong? I'll admit I don't have a good grasp of how drupal_get_form actually works; I'm proceeding mostly by cut-and-paste trial and error.

Also, and I'm not sure how this is relates, the title of the page that gets created is "Home" (which is the title of the site's homepage), instead of "Request password reset" as I would expect.

function mymodule_menu() {
  $items['password-reset'] = array(
    'title' => 'Request password reset',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('user_pass'),
    'access callback' => 'user_is_anonymous',
    'type' => MENU_LOCAL_TASK,
    'file' => drupal_get_path('user.pages.inc'),
    );
  return $items;
}

 
 

Drupal is a registered trademark of Dries Buytaert.