You are here

function twitter_status_save in Twitter 7.4

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

Saves a TwitterStatus object to {twitter}

2 calls to twitter_status_save()
twitter_fetch_mentions_timeline in ./twitter.inc
Fetches user's mentions.
twitter_fetch_user_timeline in ./twitter.inc
Fetches a user's timeline

File

./twitter.inc, line 93

Code

function twitter_status_save($status) {
  $status = array(
    'twitter_id' => $status->id,
    'screen_name' => $status->user->screen_name,
    'created_time' => strtotime($status->created_at),
    'text' => $status->text,
    'source' => $status->source,
    'in_reply_to_status_id' => $status->in_reply_to_status_id > 0 ? (string) $status->in_reply_to_status_id : NULL,
    'in_reply_to_user_id' => (int) $status->in_reply_to_user_id,
    'in_reply_to_screen_name' => $status->in_reply_to_screen_name,
    'truncated' => (int) $status->truncated,
  );
  db_merge('twitter')
    ->key(array(
    'twitter_id' => $status['twitter_id'],
  ))
    ->fields($status)
    ->execute();

  // Let other modules know that an status has been just saved.
  module_invoke_all('twitter_status_save', $status);
}