You are here

function tokenauth_get_user in Token authentication 7

Same name and namespace in other branches
  1. 6.2 tokenauth.inc \tokenauth_get_user()
  2. 6 tokenauth.inc \tokenauth_get_user()

API function for retrieving the user for a given token.

Note that while this filters out blocked users, it does not check whether the user has access to use tokenauth.

Parameters

$token: An alphanumeric string.

1 call to tokenauth_get_user()
tokenauth_menu_get_item_alter in ./tokenauth.module
Implements hook_menu_get_item_alter().

File

./tokenauth.inc, line 114
Provides tokenauth API for Token Authentication module.

Code

function tokenauth_get_user($token) {
  $sql = "SELECT tt.uid FROM {tokenauth_tokens} tt INNER JOIN {users} u ON tt.uid = u.uid WHERE token = :token AND u.status != 0";
  return db_query($sql, array(
    ':token' => $token,
  ))
    ->fetchField();
}