You are here

function drupagram_actions_set_status in Drupagram 7

Fetches drupagram account info and submits with the message to the drupagram API

Parameters

$message: The message to post

$sender: The Drupal user that has a drupagram account

1 string reference to 'drupagram_actions_set_status'
drupagram_actions_rules_action_info in drupagram_actions/drupagram_actions.rules.inc
Implements hook_rules_action_info() on behalf of the drupagram module.

File

drupagram_actions/drupagram_actions.rules.inc, line 41
Provide better intergration into the rules module

Code

function drupagram_actions_set_status($message, $sender) {
  if ($drupagram_id = db_query("SELECT drupagram_id FROM {drupagram_account} WHERE uid = :uid", array(
    ':uid' => $sender->uid,
  ))
    ->fetchField()) {
    module_load_include('inc', 'drupagram');
    $drupagram_account = drupagram_account_load($drupagram_id);
    drupagram_set_status($drupagram_account, $message);
  }
  else {
    watchdog('drupagram', 'drupagram authentication failed. Please check your account name and try again.', array(), WATCHDOG_ERROR);
  }
}