После просмотра некоторых постов здесь и в других местах, я все еще не могу вручную добавить поле выбора в профиль. (Мне нужно, чтобы список выбора заполнялся запросом SQL, не поддерживается модулем основного профиля.)
Пока что я пробую два разных способа: перехватить изменение формы ($ form_id == 'user-register' и перехватить пользователя ($ op == 'register') - но я даже не могу получить поле появляются в регистрационной форме.
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;
}
Вот попытка изменить форму крючка
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;
}