You are here

public static function DrupalOAuthToken::loadById in OAuth 1.0 6.3

Same name and namespace in other branches
  1. 7.4 includes/DrupalOAuthToken.inc \DrupalOAuthToken::loadById()
  2. 7.3 includes/DrupalOAuthToken.inc \DrupalOAuthToken::loadById()

Gets the token with the specified id

Parameters

int $id: The id of the token to get

boolean $load_provider_data: Whether to load provider related data or not

Return value

DrupalOAuthToken The loaded token object or FALSE if load failed

File

includes/DrupalOAuthToken.inc, line 201

Class

DrupalOAuthToken

Code

public static function loadById($tid, $load_provider_data = TRUE) {
  $fields = 't.*';
  $join = '';
  if ($load_provider_data) {
    $fields .= ', pt.created, pt.changed, pt.services, pt.authorized';
    $join = 'INNER JOIN {oauth_common_provider_token} pt ON pt.tid = t.tid';
  }
  return self::fromResult(db_query("SELECT " . $fields . " FROM {oauth_common_token} t " . $join . " WHERE t.tid = %d", array(
    ':tid' => $tid,
  )));
}