You are here

function twitter_actions_set_status in Twitter 7.6

Same name and namespace in other branches
  1. 7.3 twitter_actions/twitter_actions.rules.inc \twitter_actions_set_status()
  2. 7.4 twitter_actions/twitter_actions.rules.inc \twitter_actions_set_status()
  3. 7.5 twitter_actions/twitter_actions.rules.inc \twitter_actions_set_status()

Fetches Twitter account info and submits with the message to the Twitter API.

Parameters

$message: The message to post

$sender: The Drupal user that has a Twitter account

1 string reference to 'twitter_actions_set_status'
twitter_actions_rules_action_info in twitter_actions/twitter_actions.rules.inc
Implements hook_rules_action_info() on behalf of the Twitter module.

File

twitter_actions/twitter_actions.rules.inc, line 57
Provides Rules integration in order to post tweets.

Code

function twitter_actions_set_status($message, $sender) {
  $twitter_uid = _twitter_actions_get_twitter_id($sender);
  if (!isset($twitter_uid)) {

    // No Twitter authenticated account found.
    return;
  }

  // Send tweet.
  $twitter_account = entity_load_single('twitter_account', $twitter_uid);
  if (!empty($twitter_account)) {
    twitter_actions_tweet($twitter_account, $message);
  }
}