You are here

function sms_action_opt_out in SMS Framework 7

Action Implementation: Check the SMS User opt out checkbox.

Parameters

array $sms: The message that was sent and it's metadata.

1 string reference to 'sms_action_opt_out'
SmsUserRulesWebTestCase::testOptOutViaSmsAction in modules/sms_user/tests/sms_user.rules.test
Tests whether the opt out and opt in via sms rules actions work as they are supposed to.

File

modules/sms_user/sms_user.rules.inc, line 133
SMS User Rules Implementation.

Code

function sms_action_opt_out($sms) {
  $account = user_load(sms_user_get_uid($sms['number']));
  if (isset($account->sms_user)) {
    $data = $account->sms_user;
  }
  else {
    $data = array();
  }
  $data['sms_user_opt_out'] = TRUE;
  user_save($account, array(
    'sms_user' => $data,
  ), 'mobile');
}