Drupal 7 user registration custom -


i'm trying add custom fields user registration form. need save 2 of them drupal user's database , 1 own separate database.

i'm using hook_form_alter add fields , hook_form_submit save fields.

how submit first/last name fields drupal's user table , save ssn own? have function switch between 2 databases not sure how use hook_submit_form save in 1 database , in another?

function mymodule_form_alter(&$form, &$form_state, $form_id){   if($form_id == 'user_registration_form'){     $form['f_name'] = array(         '#type' => 'textfield',         '#title' => t('first name'),         '#required' => true,         '#attributes' => array('class' => array('fname'))         );     $form['l_name'] = array(         '#type' => 'textfield',         'title' => t('last name'),         '#required' => true,         '#attributes' => array('class' => array('lname'))         );     $form['ssn'] = array(         '#type' => 'textfield',         '#title' => t('social security number')         '#maxlength' => 11,         '#required' => true,         '#attributes' => array('class' => array('ssn'), 'placeholder' => '999-99-9999')         ); 

would this?

    function mymodule_form_submit($form, &$form_state){     //array of information save drupal user's table     $edit = array(               'f_name' => $form_state['values']['f_name'],               'l_name' => $form_state['values']['l_name'],               'second_email' => $form_state['values']['second_email'],         );     user_save(drupal_anonymous_user(), $edit);      drupal_set_message(t('the form has been submitted.'));  } 

i'm not sure if can use drupal's user_save() function , pass new information save or if have in .install file add these new columns , target them in form_submit?

in field save custom field data? should create custom table fields , save data in there. when load user, should load details table. there no way can directly load custom field data when user object loaded.


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -