You are here

function twitter_status_save in Twitter 7.3

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.4 twitter.inc \twitter_status_save()
  6. 7.5 twitter.inc \twitter_status_save()

Saves a TwitterStatus object to {twitter}

1 call to twitter_status_save()
twitter_fetch_user_timeline in ./twitter.inc
Fetches a user's timeline

File

./twitter.inc, line 90
Twitter API functions

Code

function twitter_status_save($status) {
  $row = 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' => $row['twitter_id'],
  ))
    ->fields($row)
    ->execute();

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