You are here

function twitter_actions_set_status_action in Twitter 6.2

Same name and namespace in other branches
  1. 6.5 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  2. 6.3 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  3. 6.4 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  4. 7.6 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  5. 7.3 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  6. 7.4 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()
  7. 7.5 twitter_actions/twitter_actions.module \twitter_actions_set_status_action()

Implementation of a configurable Drupal action. Sends an email.

1 string reference to 'twitter_actions_set_status_action'
twitter_actions_rules_action_info_alter in twitter_actions/twitter_actions.rules.inc
Implementation of hook_rules_action_info_alter().

File

twitter_actions/twitter_actions.module, line 130
Exposes Drupal actions for sending Twitter messages.

Code

function twitter_actions_set_status_action($object, $context) {
  module_load_include('inc', 'twitter');
  if (module_exists('token')) {
    $message = token_replace_multiple($context['message'], $context);
    if ($node = $context['node']) {
      if (!isset($context['node_types'][$node->type])) {
        return;
      }
      else {
        if (strstr($message, '[shorturl]') !== FALSE) {
          $message = str_replace($message, twitter_shorten_url(url('node/' . $node->nid, array(
            'absolute' => TRUE,
          ))), '[shorturl]');
        }
      }
    }
  }
  twitter_set_status($context['screen_name'], $context['password'], $message);
}