You are here

function twitter_account_load in Twitter 6.5

Same name and namespace in other branches
  1. 6.3 twitter.inc \twitter_account_load()
  2. 6.4 twitter.inc \twitter_account_load()
  3. 7.6 twitter.inc \twitter_account_load()
  4. 7.3 twitter.inc \twitter_account_load()
  5. 7.4 twitter.inc \twitter_account_load()
  6. 7.5 twitter.inc \twitter_account_load()

Load a Twitter account from {twitter_account}.

Parameters

mixed $id: Either the Twitter User ID or screen name.

boolean $type: By default the $id is assumed to be a Twitter UID, set to FALSE if $id is a screen name.

Return value

TwitterUser object or NULL.

10 calls to twitter_account_load()
twitter_account_delete in ./twitter.inc
Delete a twitter account and its statuses.
twitter_account_list_form_submit in ./twitter.pages.inc
Form submit handler for altering the list of Twitter accounts.
twitter_actions_set_status_action in twitter_actions/twitter_actions.module
Implementation of a configurable Twitter action.
twitter_cron in ./twitter.module
Implements hook_cron().
twitter_fetch_mentions_timeline in ./twitter.inc
Fetches user's mentions of an authenticated account.

... See full list

File

./twitter.inc, line 104

Code

function twitter_account_load($id, $is_uid = TRUE) {

  // The ID is the Twitter UID.
  if ($is_uid) {
    $query = "SELECT * FROM {twitter_account} WHERE twitter_uid = %d";
  }
  else {
    $query = "SELECT * FROM {twitter_account} WHERE screen_name = '%s'";
  }
  $values = db_fetch_array(db_query($query, $id));
  if (!empty($values)) {
    $values['id'] = $values['twitter_uid'];
    $account = new TwitterUser($values);
    $account
      ->set_auth($values);
    $account->import = $values['import'];
    $account->mentions = $values['mentions'];
    $account->is_global = $values['is_global'];
    return $account;
  }
  return NULL;
}