You are here

function twitter_fetch_mentions_timeline in Twitter 7.5

Same name and namespace in other branches
  1. 6.5 twitter.inc \twitter_fetch_mentions_timeline()
  2. 7.6 twitter.inc \twitter_fetch_mentions_timeline()
  3. 7.4 twitter.inc \twitter_fetch_mentions_timeline()

Fetches user's mentions of an authenticated account.

1 call to twitter_fetch_mentions_timeline()
twitter_cron in ./twitter.module
Implements hook_cron().

File

./twitter.inc, line 391

Code

function twitter_fetch_mentions_timeline($id) {
  $twitter_account = twitter_account_load($id);

  // Connect to Twitter's API using the authenticated account to fetch mentions.
  $twitter = twitter_connect($twitter_account);
  if (empty($twitter)) {
    watchdog('twitter', 'Unable to authenticate to download mentions for the %name account.', array(
      '%name' => $twitter_account->screen_name,
    ));
    return FALSE;
  }
  $params = array();
  $statuses = $twitter
    ->mentions_timeline($params);
  foreach ($statuses as $status) {
    if (!twitter_account_load($status->user->id)) {
      twitter_account_save($status->user);
    }
    twitter_status_save($status);
  }
}