You are here

public static function DrupalOAuthConsumer::loadById in OAuth 1.0 6.3

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

Gets a provider consumer with the specified id

Parameters

int $id: The id of the consumer to get

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

Return value

DrupalOAuthConsumer The loaded consumer object or FALSE if load failed

4 calls to DrupalOAuthConsumer::loadById()
DrupalOAuthToken::fromResult in includes/DrupalOAuthToken.inc
Constructs a token from a db-result resource
DrupalOAuthToken::__construct in includes/DrupalOAuthToken.inc
key = the token secret = the token secret
oauth_common_consumer_load in ./oauth_common.module
Menu system wildcard loader for provider consumers.
oauth_common_page_authorized in ./oauth_common.pages.inc
Menu callback for when something has been authorized - used in both client and provider flow

File

includes/DrupalOAuthConsumer.inc, line 157

Class

DrupalOAuthConsumer

Code

public static function loadById($csid, $load_provider_data = TRUE) {
  $fields = 'c.csid, c.consumer_key, c.secret, c.configuration';
  $join = '';
  if ($load_provider_data) {
    $fields .= ', pc.created, pc.changed, pc.uid, pc.name, pc.context, pc.callback_url';
    $join = 'LEFT JOIN {oauth_common_provider_consumer} pc ON pc.csid = c.csid';
  }
  return self::fromResult(db_query("SELECT " . $fields . " FROM {oauth_common_consumer} c " . $join . " WHERE c.csid = %d", array(
    ':csid' => $csid,
  )));
}