function twitter_fetch_user_timeline in Twitter 7.4
Same name and namespace in other branches
- 6.5 twitter.inc \twitter_fetch_user_timeline()
- 6.3 twitter.inc \twitter_fetch_user_timeline()
- 6.4 twitter.inc \twitter_fetch_user_timeline()
- 7.6 twitter.inc \twitter_fetch_user_timeline()
- 7.3 twitter.inc \twitter_fetch_user_timeline()
- 7.5 twitter.inc \twitter_fetch_user_timeline()
Fetches a user's timeline
1 call to twitter_fetch_user_timeline()
- twitter_cron in ./
twitter.module - Implements hook_cron().
File
- ./
twitter.inc, line 131
Code
function twitter_fetch_user_timeline($id) {
$account = twitter_account_load($id);
$since = db_query("SELECT MAX(twitter_id) FROM {twitter} WHERE screen_name = :screen_name", array(
':screen_name' => $account->screen_name,
))
->fetchField();
$twitter = twitter_connect($account);
$params = array();
if ($since) {
$params['since_id'] = $since;
}
$statuses = $twitter
->user_timeline($account->id, $params);
foreach ($statuses as $status) {
twitter_status_save($status);
}
if (count($statuses) > 0) {
twitter_account_save($statuses[0]->user);
}
}