function _twitter_actions_get_twitter_id in Twitter 6.5
Same name and namespace in other branches
- 7.6 twitter_actions/twitter_actions.module \_twitter_actions_get_twitter_id()
- 7.5 twitter_actions/twitter_actions.module \_twitter_actions_get_twitter_id()
Validates the Twitter account to use to send a Tweet.
If it is a Twitter account, it will check it still exists. If it is [current user], it will see if the current user has an authenticated Twitter account to use.
Parameters
string $screen_name: The selected value that represents a Twitter account to use.
Return value
Integer the Twitter ID of the account to use or NULL.
1 call to _twitter_actions_get_twitter_id()
- twitter_actions_set_status_action in twitter_actions/
twitter_actions.module - Implementation of a configurable Twitter action.
File
- twitter_actions/
twitter_actions.module, line 133 - Exposes Drupal actions for sending Twitter messages.
Code
function _twitter_actions_get_twitter_id($screen_name) {
$twitter_uid = NULL;
// Find out the Twitter ID to use.
if ($screen_name == '[current user]') {
// Check if this user has an authenticated account.
global $user;
$account = user_load($user->uid);
foreach ($account->twitter_accounts as $twitter_account) {
if ($twitter_account
->is_auth()) {
$twitter_uid = $twitter_account->id;
}
}
}
else {
$twitter_uid = db_result(db_query("SELECT twitter_uid\n FROM {twitter_account}\n WHERE screen_name = '%s'", $screen_name));
}
return $twitter_uid;
}