You are here

function twitter_account_save in Twitter 6.3

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

Saves a TwitterUser object to {twitter_account}

5 calls to twitter_account_save()
twitter_account_form_submit in ./twitter.pages.inc
Implements hook_FORM_ID_submit()
twitter_account_list_form_submit in ./twitter.pages.inc
twitter_fetch_user_timeline in ./twitter.inc
Fetches a user's timeline
twitter_oauth_callback_submit in ./twitter.pages.inc
Implements hook_form_FORM_ID_submit()
twitter_signin_user in twitter_signin/twitter_signin.module
Implementation of hook_user().

File

./twitter.inc, line 26

Code

function twitter_account_save($twitter_user, $save_auth = FALSE, $account = NULL) {
  $values = (array) $twitter_user;
  $values['twitter_uid'] = $values['id'];
  if ($save_auth) {
    $values += $twitter_user
      ->get_auth();
    if (empty($account)) {
      global $user;
      $account = $user;
    }
    $values['uid'] = $account->uid;
  }
  if (db_result(db_query("SELECT 1 FROM {twitter_account} WHERE twitter_uid = %d", $values['id']))) {
    drupal_write_record('twitter_account', $values, array(
      'twitter_uid',
    ));
  }
  else {
    drupal_write_record('twitter_account', $values);
  }
}