You are here

function services_token_access_load_by_user in Services Token Access 7

Get the token data based on user ID.

Parameters

int $uid: User ID

bool $raw_value: If set to TRUE, the raw token string will be returned

Return value

mixed Array with token data, or raw token string, FALSE if not found.

1 call to services_token_access_load_by_user()
services_token_access_user_form in ./services_token_access.inc
Form callback for the user token management form.

File

./services_token_access.module, line 109
Module file for services_token_access module.

Code

function services_token_access_load_by_user($uid, $raw_value = FALSE) {
  $result = db_select('services_token_access_tokens', 's')
    ->fields('s')
    ->condition('uid', $uid)
    ->execute()
    ->fetchAssoc();
  if ($result) {
    return $raw_value ? $result['token'] : $result;
  }
  return FALSE;
}