You are here

function ajax_register_login_ajax_callback in Ajax Login/Register 7.3

Ajax callback for user login form.

1 string reference to 'ajax_register_login_ajax_callback'
ajax_register_form_alter in ./ajax_register.module
Implements hook_form_alter().

File

./ajax_register.module, line 159

Code

function ajax_register_login_ajax_callback() {
  $commands = array();
  if (!form_get_errors()) {

    // Set up success message.
    drupal_set_message(t('Login successful. You are now being redirected.'));

    // Reload current page.
    ctools_include('ajax');
    ctools_add_js('ajax-responder');
    $commands[] = ctools_ajax_command_reload();
  }

  // Add messages to login form.
  $commands[] = ajax_command_html('#ajax-register-login-messages', theme('status_messages'));

  // Return ajax commands.
  return array(
    '#type' => 'ajax',
    '#commands' => $commands,
  );
}