1

Have searched a lot for this issue. I am not sure if it is a php issue or Drupal issue but the error message is pointing towards Drupal. Whenever i go to the user edit form in Drupal 7 i get the following error:

Notice: Undefined index: #title in user_account_form() (line 1070 of /opt/lampp/htdocs/modules/user/user.module)

I have searched a lot. This seemed relevant http://drupal.org/node/1088964 but it did not work out for me. Any suggestions would be appreciated.

Thanks

Edit 1: I am using 7.18 and yes i have done some changes in user registration form...i have commented the lines in bold and added a placeholder. Now when i uncomment them then no error occurs but then in my user registration form those fields show up...let me clear this through 2 images...1st image shows the case when i commented the lines(in bold) and added a placeholder (this is what i want it to look like): enter image description here

However this gives me the error in user edit form. Now when i uncomment, it looks like enter image description here

I do not want the labels Username and password to show up there. How can i achieve this without that error bugging me. The line number 1070 is inside user_account_form as well. I have realized the error is because i have commented out and it is looking for a title field or password field but then my registration form looses its appearance as i want. Is there a way round to do this.

function user_account_form(&$form, &$form_state) {
      global $user;

      $account = $form['#user'];
      $register = ($form['#user']->uid > 0 ? FALSE : TRUE);

      $admin = user_access('administer users');

      $form['#validate'][] = 'user_account_form_validate';

      // Account information.
      $form['account'] = array(
        '#type'   => 'container',
        '#weight' => -10,
      );
      // Only show name field on registration form or user can change own username.
      $form['account']['name'] = array(
        '#type' => 'textfield',
        **//'#title' => t('Username'),**
        '#maxlength' => USERNAME_MAX_LENGTH,
        //'#description' => t('Spaces are allowed; punctuation is not allowed except for periods, hyphens, apostrophes, and underscores.'),
        '#required' => TRUE,
        **'#attributes' => array('class' => array('username'), 'placeholder'=>t('Username')),**
        '#default_value' => (!$register ? $account->name : ''),
        '#access' => ($register || ($user->uid == $account->uid && user_access('change own username')) || $admin),
        '#weight' => -10,
      );

      $form['account']['mail'] = array(
        '#type' => 'textfield',
       **'#title' => t(' Email Id'),**
        '#maxlength' => EMAIL_MAX_LENGTH,
       // '#description' => t('A valid e-mail address. All e-mails from the system will be sent to this address. The e-mail address is not made public and will only be used if you wish to receive a new password or wish to receive certain news or notifications by e-mail.'),
        '#required' => TRUE,
        '#default_value' => (!$register ? $account->mail : ''),
        **'#attributes' => array('placeholder' => t ('E-mail')),**
      );

The lines where the error points to :

if (!$pass_reset) {
      $protected_values['mail'] = $form['account']['mail']['#title'];
      $protected_values['pass'] = t('Password');
  • Do you have any user profile modules installed? When did the error begin? – beth Feb 17 '13 at 3:24
  • @beth...i have the core profile module but have also installed the Profile2 module...I know is should be aware when the error started but it just so happened that i never went to user edit page before....i just know that the error is there for the last 2 days...i will just disable Profile2 and check and inform you – why Feb 17 '13 at 3:30
  • i just disabled the Profile2 module but the error remains – why Feb 17 '13 at 3:34
  • the error is pointing to this line in user.module: $protected_values['mail'] = $form['account']['mail']['#title']; – why Feb 17 '13 at 3:36
  • For which role(s) is this happening? Are you viewing your own or other users' edit forms? – beth Feb 17 '13 at 3:56
1

You shouldn't be modifying any core files. Removing a declaration for a value that needs to be used elsewhere is causing your problem, and the solution is to make your changes using hooks and templates in custom modules and themes, which are Drupal's way of allowing users to modify behavior and output.

This thread contains discussion of theming the user edit page, and has links to helpful information.

  • yes...even i think so...but i strongly feel there's a lack of proper documentation for issues regarding customizing user profiles and core Drupal functionalities, especially for beginners...once i get a hold of it, i will document my efforts...hope it will help someone – why Feb 17 '13 at 17:15
  • I agree with you about that. Are any of the links in the linked thread helpful to you? – beth Feb 17 '13 at 17:57
  • yes...it definitely will set me on the right course of action..by the way..if you ever set out to document i would love to join in the effort – why Feb 17 '13 at 18:03
  • You might want to check out this as well:drupal.stackexchange.com/questions/10494/… – beth Feb 17 '13 at 18:18

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.