function twitter_account_save in Twitter 7.5
Same name and namespace in other branches
- 6.5 twitter.inc \twitter_account_save()
- 6.3 twitter.inc \twitter_account_save()
- 6.4 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()
Saves a TwitterUser object to {twitter_account}
6 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_mentions_timeline in ./
twitter.inc - Fetches user's mentions of an authenticated account.
- twitter_fetch_user_timeline in ./
twitter.inc - Fetches a user's timeline.
- twitter_non_auth_account_form_submit in ./
twitter.pages.inc - Submit form handler to add a non-authenticated Twitter account.
- twitter_oauth_callback_form_submit in ./
twitter.pages.inc - Handle a Twitter OAuth return request and store the account creds in the DB.
File
- ./
twitter.inc, line 60
Code
function twitter_account_save($twitter_user, $save_auth = FALSE) {
$values = (array) $twitter_user;
$values['twitter_uid'] = $values['id'];
foreach (array(
'protected',
'verified',
'profile_background_tile',
) as $k) {
if (isset($values[$k])) {
$values[$k] = (int) $values[$k];
}
}
if ($save_auth) {
$values += $twitter_user
->get_auth();
}
$schema = drupal_get_schema('twitter_account');
foreach ($values as $k => $v) {
if (!isset($schema['fields'][$k])) {
unset($values[$k]);
}
}
db_merge('twitter_account')
->key(array(
'twitter_uid' => $values['twitter_uid'],
))
->fields($values)
->execute();
// Notify other modules of the twitter account save
module_invoke_all('twitter_account_save', $values);
}