tags:

views:

461

answers:

1

After reviewing some posts here and elsewhere, I still can't seem to manually add a select field to the profile. (I need the select list to be populated with a SQL query, not supported with core profile module.)

So far, I am trying two different ways: hook form alter ($form_id == 'user-register' & hook user ($op == 'register') -- but I can't even get the field to appear in the registration form.

    function accountselect_user($op, &$edit, &$account, $category = NULL) {
    if ($op == 'register'){
    $fields['account_select'] = array(
    '#type' => 'fieldset',
    '#title' => t('Your Security Question')
    );
    $fields['account_select']['account_name'] = array(
    '#type' => 'select',
    '#default_value' => 'Select',
    '#description' => t('Select a verification question in case you forget your password'),
    '#options' => array(t('Select One'),
    t('Where you attended Elementry School'), t('Your Best Man'))
    );
return $fields;
    }

Here is the hook form alter attempt

  function accountselect_form_alter(&$form, $form_state, $form_id){
              if($form_id == 'user-register')   {
               $form['account_select']['account_name'] = array(
               '#type' => 'select',
               '#title' => t('Account'),
               '#description' => t('Enter the account to which the contact belongs.'),
               '#options' => array(t('Account1'),t('account2'), t('account3')),
               '#default_value' => $edit ['Account']
               );
               }
               return $fields;
            }
A: 

Sorry Guys, the code here is correct. I did a little debugging when the module was first enabled. I thought I had successfully fixed the problem, but what really happened is that the module became disabled. So, no matter what was in there, it would have had no effect....

No worries, I've punched myself in the face for the stupid question....

Tim