You are here

function ctools_ajax_sample_login_success in Chaos Tool Suite (ctools) 7

Same name and namespace in other branches
  1. 6 ctools_ajax_sample/ctools_ajax_sample.module \ctools_ajax_sample_login_success()

Post-login processor: should we go to the user account or stay in place?

1 string reference to 'ctools_ajax_sample_login_success'
ctools_ajax_sample_menu in ctools_ajax_sample/ctools_ajax_sample.module
Implementation of hook_menu()

File

ctools_ajax_sample/ctools_ajax_sample.module, line 285
Sample AJAX functionality so people can see some of the CTools AJAX features in use.

Code

function ctools_ajax_sample_login_success($js, $action) {
  if (!$js) {

    // We should never be here out of ajax context.
    return MENU_NOT_FOUND;
  }
  ctools_include('ajax');
  ctools_add_js('ajax-responder');
  $commands = array();
  if ($action == 'inplace') {

    // Stay here.
    $commands[] = ctools_ajax_command_reload();
  }
  else {

    // Bounce bounce.
    $commands[] = ctools_ajax_command_redirect('user');
  }
  print ajax_render($commands);
  exit;
}