You are here

function tokenauth_get_user in Token authentication 6.2

Same name and namespace in other branches
  1. 6 tokenauth.inc \tokenauth_get_user()
  2. 7 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_init in ./tokenauth.module
Implementation of hook_init().

File

./tokenauth.inc, line 120
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 = '%s' AND u.status != 0";
  return db_result(db_query($sql, $token));
}