0

I have a custom module that overrides the /user/register page so that in addtion to username and email it also asks for about 10 or so Profile2 pieces of information.

The code I have so far:

    $form['hi'] = array(
      '#type' => 'fieldset',
      '#prefix' => '<div id="container_a">',
      '#suffix' => '</div>',
      '#title' => t('Additional Info'),
    );

    $form['hi']['l'] = array(
      '#type' => 'fieldset',
      '#prefix' => '<div id="left">',
      '#suffix' => '</div>',
    );

    $form['hi']['r'] = array(
      '#prefix' => '<div id="right">',
      '#suffix' => '</div>',
      '#type' => 'fieldset',

    );

    $form['hi']['l']['h_ph'] = $form['profile_memberlist']['field_home_phone']['und'][0];

The form renders a space for username, email and Home Phone. I fill out the form, and submit, and I get the following:

Thank you for applying for an account. Your account is currently pending approval by the site administrator. In the meantime, a welcome message with further instructions has been sent to your e-mail >address.

Error message

Notice: Undefined index: profile_memberlist in profile2_form_submit_build_profile() (line 471 of /var/www/html/example/sites/all/modules/profile2/profile2.module).
Warning: array_merge(): Argument #1 is not an array in field_default_extract_form_values() (line 36 of /var/www/html/example/modules/field/field.default.inc).
Recoverable fatal error: Argument 2 passed to drupal_array_get_nested_value() must be an array, null given, called in /var/www/html/example/modules/field/field.default.inc on line 38 and defined in drupal_array_get_nested_value() (line 6608 of /var/www/html/example/includes/common.inc).

I've double checked and the memberlist is the name ( machine name) of the profile2 I am trying to get populated.

1

1 Answer 1

0

I had this in my module:

unset($form['profile_memberlist']);

Which is what I needed to do so I could override and theme the way the form elements were presented. I commented that out but then I got a dual display of form elements, which I was able to disable with the follwing code:

$form['profile_memberlist'] = array(
      '#type' => 'hidden',
);

Your Answer

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

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