function twitter_account_load in Twitter 7.5
Same name and namespace in other branches
- 6.5 twitter.inc \twitter_account_load()
- 6.3 twitter.inc \twitter_account_load()
- 6.4 twitter.inc \twitter_account_load()
- 7.6 twitter.inc \twitter_account_load()
- 7.3 twitter.inc \twitter_account_load()
- 7.4 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.
12 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_post in twitter_actions/
twitter_actions.module - Silently posts a message to Twitter
- twitter_cron in ./
twitter.module - Implements hook_cron().
- twitter_fetch_mentions_timeline in ./
twitter.inc - Fetches user's mentions of an authenticated account.
File
- ./
twitter.inc, line 99
Code
function twitter_account_load($id, $is_uid = TRUE) {
// The ID is the Twitter UID.
if ($is_uid) {
$query = db_query('SELECT *
FROM {twitter_account}
WHERE twitter_uid = :twitter_uid', array(
':twitter_uid' => $id,
));
}
else {
$query = db_query('SELECT *
FROM {twitter_account}
WHERE screen_name = :screen_name', array(
':screen_name' => $id,
));
}
$values = $query
->fetchAssoc();
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;
}