You are here

function ctools_ajax_sample_login_success in Chaos Tool Suite (ctools) 6

Same name and namespace in other branches
  1. 7 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 224
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');
  $commands = array();
  if ($action == 'inplace') {

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

    // bounce bounce
    $commands[] = ctools_ajax_command_redirect('user');
  }
  ctools_ajax_render($commands);
}