You are here

function sms_user_send in SMS Framework 6.2

Same name and namespace in other branches
  1. 5 modules/sms_user/sms_user.module \sms_user_send()
  2. 6 modules/sms_user/sms_user.module \sms_user_send()
  3. 7 modules/sms_user/sms_user.module \sms_user_send()

Send a message to a user.

5 calls to sms_user_send()
sms_actions_send_action in modules/sms_actions/sms_actions.module
Implementation of a Drupal action.
sms_action_user_send in modules/sms_user/sms_user.rules.inc
Rules action callback to send sms message to user.
sms_blast_form_submit in modules/sms_blast/sms_blast.module
Submit handler for the sms blast form
sms_user_send_sms_action in modules/sms_user/sms_user.actions.inc
sms_user_sms_incoming in modules/sms_user/sms_user.module
Implementation of hook_sms_incoming().

File

modules/sms_user/sms_user.module, line 63
Provides integration between the SMS Framework and Drupal users.

Code

function sms_user_send($uid, $message) {
  $account = user_load($uid);
  if (user_access('receive sms', $account)) {

    //Check if the user is enabled to receive SMS
    if ($account->sms_user[0]['status'] == 2) {
      return sms_send($account->sms_user[0]['number'], $message, $account->sms_user[0]['gateway']);
    }
    else {
      return FALSE;
    }
  }
  else {
    drupal_set_message(t("User %user is not enabled to receive SMS, see 'receive sms' permission", array(
      '%user' => $account->name,
    )), 'status', TRUE);
  }
}