You are here

function sms_action_opt_in in SMS Framework 7

Action Implementation: Uncheck SMS User the opt out checkbox.

Parameters

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

1 string reference to 'sms_action_opt_in'
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 151
SMS User Rules Implementation.

Code

function sms_action_opt_in($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'] = FALSE;
  user_save($account, array(
    'sms_user' => $data,
  ), 'mobile');
}