You are here

function tfa_basic_set_mobile_number in TFA Basic plugins 7

Update mobile number on account.

Parameters

object $account:

string $number:

1 call to tfa_basic_set_mobile_number()
tfa_basic_setup_form_submit in ./tfa_basic.pages.inc
Setup form submit.

File

./tfa_basic.module, line 342

Code

function tfa_basic_set_mobile_number($account, $number) {
  $phone_field = variable_get('tfa_basic_phone_field', '');
  if ($phone_field !== FALSE) {
    if (isset($account->{$phone_field})) {
      $edit = array(
        $phone_field => array(
          LANGUAGE_NONE => array(
            0 => array(
              'value' => $number,
            ),
          ),
        ),
      );
      user_save($account, $edit);
    }
  }
  $alterable = array(
    'account' => $account,
    'number' => $number,
  );

  // Allow other modules to set the mobile number for this account.
  drupal_alter('tfa_basic_set_mobile_number', $alterable);
}