Is there any way to automatic login user after a successful registration, it seems I can't find any tuts/solution how to do this.Thanks!!
Any replies are much appreciated....
in my template.php
function drupal_onrevue1_form_user_register_submit($form, &$form_state){
//$form_state['rebuild'] = TRUE;
$form_state['redirect'] = "user/login";
//print_r($form_state);die();
$edit = array(
'name' => $form_state['values']['name'],
'pass' => $form_state['values']['current_pass'],
'field_first_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_first_name']))),
'field_last_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_last_name']))),
'field_middle_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_middle_name']))),
'field_year_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_year_select']))),
'field_month_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_month_select']))),
'field_date_select' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_date_select']))),
'field_gender' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_gender_select']))),
'mail' => $form_state['values']['field_mail'],
'init' => $form_state['values']['field_mail'],
'status' => 1,
'access' => REQUEST_TIME,
);
$account->is_new = TRUE;
$hello = user_save($account, $edit);
//print_r($hello);die();
}
$form_state['uid'] = $userRecord; user_login_submit(array(), $form_state);
– Junnel Gallemaso Aug 2 '12 at 2:11drupal_onrevue1_form_user_register_submit
a hook? It's best to write this kind of function in a custom module rather than the theme'stemplate.php
file because the theme should only deal with front end output (i.e. the rendering, styling pages) not contain any business logic. – therobyouknow Jan 25 '18 at 15:30