You are here

function twitter_fetch_mentions_timeline in Twitter 7.6

Same name and namespace in other branches
  1. 6.5 twitter.inc \twitter_fetch_mentions_timeline()
  2. 7.4 twitter.inc \twitter_fetch_mentions_timeline()
  3. 7.5 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 331

Code

function twitter_fetch_mentions_timeline($id) {
  $twitter_account = entity_load_single('twitter_account', $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' => $account->screen_name,
    ));
    return FALSE;
  }
  $params = array();
  $statuses = $twitter
    ->mentions_timeline($params);
  foreach ($statuses as $twitter_status) {
    twitter_account_save($twitter_status->user);
    twitter_status_save($twitter_status);
  }
}