You are here

function session_limit_token_values in Session Limit 6

Same name and namespace in other branches
  1. 6.2 session_limit.module \session_limit_token_values()

Implementation of hook_token_values().

File

./session_limit.module, line 235
Limits multiple sessions per user.

Code

function session_limit_token_values($type, $object = NULL, $options = array()) {
  if ($object == 'session_limit' || $object == 'system' || $type == 'global') {
    global $user;
    $tokens['session-limit-default'] = variable_get('session_limit_max', 1);
    $tokens['session-limit-max'] = session_limit_user_max_sessions($user);
    $tokens['session-limit-role'] = session_limit_user_max_sessions_byrole($user);
    $tokens['session-limit-user'] = empty($user->session_limit) ? 0 : check_plain($user->session_limit);
    return $tokens;
  }
}