You are here

function sms_user_sms_send in SMS Framework 7

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

Implements hook_sms_send().

File

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

Code

function sms_user_sms_send(&$number, &$message, &$options, &$gateway) {
  if (variable_get('sms_user_sleep', 1) && ($uid = sms_user_get_uid($number))) {
    $account = user_load_multiple(array(
      $uid,
    ), array(
      'status' => 1,
    ));
    $account = array_shift($account);
    if (_sms_user_opted_out($account)) {
      unset($gateway['send']);
      watchdog('sms_user', 'Message was not sent to @user because user opted out.', array(
        '@user' => $account->name,
      ));
    }
    else {
      if (_sms_user_sleep_active($account)) {
        unset($gateway['send']);
        watchdog('sms_user', 'Message was not sent to @user due to sleep settings.', array(
          '@user' => $account->name,
        ));
      }
    }
  }
}