4

I want to know the Request New Password form id. (www.example.com/user/password).
I found out that the register form is "user_register_form" and tried same for password (user_password_form / user_pass_form / user_pass_reset) but nothing worked.

Hope you can help me! Thanks a lot!

Edit: If you could tell me the account form id in the same breathe, the answer would be simply awesome.

11
  • Are you in Drupal 6 or 7? Commented Aug 12, 2012 at 19:21
  • I'am using Drupal 7. Commented Aug 12, 2012 at 20:26
  • 1
    What is the path of the "account" page to which you refer (excluding your base_url)? Commented Aug 16, 2012 at 0:13
  • 1
    I probably do, what's the path of the form (excluding base_url)? Or are you referring to the user profile page itself? Commented Aug 16, 2012 at 0:22
  • 1
    The form id on that page is 'user_profile_form'. If there is a bunch of stuff you need to do, you might better off opening a new question. Otherwise, I can answer quickly here. Or edit my existing answer. Commented Aug 16, 2012 at 0:38

3 Answers 3

3

Note that print_r will be better in this case because to see the form he desires one must be logged out otherwise you'll get the password reset for the active user, which is different.

Leandros, try putting this in your theme's template.php and visiting user/password (not logged in)

function YOURTHEMENAME_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'user_pass': print '<pre>';print_r($form); print '</pre>'; break; } } 

It will give you an array of everything that's in there. Then, say you wanted to change the text "Username or e-mail address" and the text on the submit button you could do this:

function YOURTHEMENAME_form_alter(&$form, &$form_state, $form_id) { switch ($form_id) { case 'user_pass': //print '<pre>';print_r($form); print '</pre>'; $form['name']['#title'] = 'Please type your username/email quickly.'; $form['actions']['submit']['#value'] = 'Email it to me!'; break; } } 
2
  • 1
    The access devel information permission also can give access to anonymous users to see the devel messages. Commented Mar 16, 2014 at 1:37
  • Absolutely @rooby , good call. Just don't forget to uncheck the permission or, better yet, uninstall Devel altogether, before you go to production. Could leave a big security hole there... Commented Mar 22, 2014 at 4:58
1

install the Devel module. Then implement hook_form_alter() and use dpm().

Then goto any page you want to see a form details on, you will see it in the System Messages block.

function MYMODULE_form_alter(&$form, &$form_state, $form_id) { dpm($form, '$form info for $form_id '.$form_id); } 
3
  • Thanks! The form id is 'user_pass', but if I implement the form I get that error Notice: Undefined index: user_pass in drupal_retrieve_form() (line 765 of /var/www/********/htdocs/includes/form.inc). Warning: call_user_func_array() expects parameter 1 to be a valid callback, function 'user_pass' not found or invalid function name in drupal_retrieve_form() (line 800 of /var/www/********/htdocs/includes/form.inc). Commented Aug 12, 2012 at 18:45
  • I am not sure what you're trying to do to the user_pass_form. You shouldnt have to implement it yourself, you should be able to alter the form on the page with hook_form_alter() to add your own validation, form items, etc ... Commented Aug 13, 2012 at 4:41
  • I did a panal layout with pages and wanted to implement it in my panel layout. Commented Aug 14, 2012 at 13:59
0

The IDs for these are:

  • User register: user_register_form
  • User login: form_user_login
  • User pass: user_pass

I suggest you to use the hook_form_FORM_ID_alter.

e.g. For change something in the User pass form:

/** * Implements hook_form_user_pass_alter(). */ function my_module_form_user_pass_alter($form, &$form_state) { // Change text button. $form['actions']['submit']['#value'] = t('Send password'); } 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.