function twitter_account_save in Twitter 6.4
Same name and namespace in other branches
- 6.5 twitter.inc \twitter_account_save()
- 6.3 twitter.inc \twitter_account_save()
- 7.6 twitter.inc \twitter_account_save()
- 7.3 twitter.inc \twitter_account_save()
- 7.4 twitter.inc \twitter_account_save()
- 7.5 twitter.inc \twitter_account_save()
Saves a TwitterUser object to {twitter_account}
4 calls to twitter_account_save()
- twitter_account_list_form_submit in ./
twitter.pages.inc - Form submit handler for altering the list of Twitter accounts.
- 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 28
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);
}
}