You are here

function sms_blast_form_submit in SMS Framework 5

Same name and namespace in other branches
  1. 6.2 modules/sms_blast/sms_blast.module \sms_blast_form_submit()
  2. 6 modules/sms_blast/sms_blast.module \sms_blast_form_submit()
  3. 7 modules/sms_blast/sms_blast.module \sms_blast_form_submit()

File

modules/sms_blast/sms_blast.module, line 51
Allows bulk text messages to be sent to registered users.

Code

function sms_blast_form_submit($form_id, $form_values) {
  $result = db_query("SELECT uid FROM {users} WHERE uid <> 0");
  while ($row = db_fetch_array($result)) {
    $users[] = $row;
  }
  foreach ($users as $user) {
    $this_user = user_load(array(
      'uid' => $user['uid'],
    ));
    if ($this_user->sms_user[0]['status'] == 2) {
      sms_send($this_user->sms_user[0]['number'], $form_values['message'], $this_user->sms_user[0]['gateway']);
    }
  }
}