You are here

public function MessageNotifierSMS::deliver in Message Notify 7.2

Deliver a message via the required transport method.

Parameters

$output: Array keyed by the view mode, and the rendered entity in the specified view mode.

Return value

TRUE or FALSE based on delivery status.

Overrides MessageNotifierBase::deliver

File

plugins/notifier/sms/MessageNotifierSMS.class.php, line 10
SMS notifier.

Class

MessageNotifierSMS
@file SMS notifier.

Code

public function deliver(array $output = array()) {
  if (empty($this->message->smsNumber)) {

    // Try to get the SMS number from the account.
    $account = user_load($this->message->uid);
    if (!empty($account->sms_user['number'])) {
      $this->message->smsNumber = $account->sms_user['number'];
    }
  }
  if (empty($this->message->smsNumber)) {
    throw new MessageNotifyException('Message cannot be sent using SMS as the "smsNumber" property is missing from the Message entity or user entity.');
  }
  return sms_send($this->message->smsNumber, strip_tags($output['message_notify_sms_body']));
}