You are here

function tfa_basic_get_mobile_number in TFA Basic plugins 7

Get mobile number for an account.

Parameters

object $account: User account object.

Return value

string|FALSE Mobile phone number or FALSE if not set.

5 calls to tfa_basic_get_mobile_number()
tfa_basic_setup_form in ./tfa_basic.pages.inc
TFA setup form router.
tfa_basic_setup_form_submit in ./tfa_basic.pages.inc
Setup form submit.
tfa_basic_sms_create in ./tfa_basic.module
Create TfaBasicSms plugin.
tfa_basic_tfa_context_alter in ./tfa_basic.module
Alters tfa_context array to set plugins from user settings.
_tfa_basic_plugin_setup_form_overview in ./tfa_basic.pages.inc
Get TFA basic setup action links for use on overview page.

File

./tfa_basic.module, line 317

Code

function tfa_basic_get_mobile_number($account) {
  $phone_field = variable_get('tfa_basic_phone_field', '');
  $number = FALSE;

  // Note, set tfa_basic_phone_field to FALSE to avoid using account field as
  // storage.
  if (!empty($phone_field)) {
    if (!empty($account->{$phone_field}[LANGUAGE_NONE][0]['value'])) {
      $number = $account->{$phone_field}[LANGUAGE_NONE][0]['value'];
    }
  }
  $alterable = array(
    'account' => $account,
    'number' => $number,
  );

  // Allow other modules to supply the mobile number for this account.
  drupal_alter('tfa_basic_get_mobile_number', $alterable);
  return $alterable['number'];
}