You are here

function oa_core_login_get_destination in Open Atrium Core 7.2

Process all destination rules and return destination path. This function is intended to be used by external modules.

1 call to oa_core_login_get_destination()
oa_core_login_perform_redirect in includes/oa_core.login.inc
Evaluate rules and perform redirect. This function is intended to be used by external modules.

File

includes/oa_core.login.inc, line 119
Code for controlling redirection of login Some of this code comes from the login_destination module

Code

function oa_core_login_get_destination($trigger = '', $current = NULL) {
  global $user;
  $homepage = variable_get('site_frontpage', 'home');

  // Get all the login destination rules from the database.
  if ($trigger == 'login') {
    $spaces = oa_core_get_groups_by_user($user, 'node');

    // if not a member of any spaces, go to default home
    if (count($spaces) <= 0) {
      return $homepage;
    }
    return 'user/' . $user->uid . '/view';
  }
  elseif ($trigger == 'logout') {
    return $homepage;
  }

  // no rule matched
  return FALSE;
}