function fancy_login_user_login_block_ajax_callback in Fancy Login 7.2
Same name and namespace in other branches
- 8.2 fancy_login.module \fancy_login_user_login_block_ajax_callback()
- 7.3 fancy_login.module \fancy_login_user_login_block_ajax_callback()
- 3.0.x fancy_login.module \fancy_login_user_login_block_ajax_callback()
Ajax callback function for user_login_block submit button
1 string reference to 'fancy_login_user_login_block_ajax_callback'
- fancy_login_form_alter in ./
fancy_login.module - Implementation of hook_form_alter()
File
- ./
fancy_login.module, line 227
Code
function fancy_login_user_login_block_ajax_callback($form, &$form_state) {
global $destination;
$commands = array();
$form = render($form);
$message_data = drupal_get_messages(NULL, FALSE);
if (!count($message_data['error'])) {
if (variable_get('fancy_login_no_redirect', 0)) {
drupal_set_message(t('You have been successfully logged in. Please wait the page is refreshed.'));
$commands[] = array(
'command' => 'fancyLoginRefreshPage',
'closePopup' => TRUE,
);
}
else {
drupal_set_message(t('You have been successfully logged in. Please wait while you are redirected.'));
$dest = $destination && is_array($destination) && isset($destination[0]) ? $destination[0] : $form_state['redirect'];
$commands[] = array(
'command' => 'fancyLoginRedirect',
'closePopup' => TRUE,
'destination' => url($dest),
);
}
}
$messages = theme('status_messages');
$commands[] = ajax_command_replace(NULL, $messages . $form);
return array(
'#type' => 'ajax',
'#commands' => $commands,
);
}