You are here

function tfa_get_phone_number in Two-factor Authentication (TFA) 7

Same name and namespace in other branches
  1. 6 tfa.module \tfa_get_phone_number()

Address callback for SMS, uses tfa_phone_field variable.

1 call to tfa_get_phone_number()
_tfa_send_code in ./tfa.module
Send the code using SMS Framework.
1 string reference to 'tfa_get_phone_number'
sms_tfa_api in ./tfa.module
Implements hook_tfa_api() on behalf of the SMS module.

File

./tfa.module, line 321
Two-factor authentication for Drupal.

Code

function tfa_get_phone_number($account) {
  $phone_field = variable_get('tfa_phone_field', 'field_phone_number');
  if (empty($phone_field)) {
    return FALSE;
  }
  if (!isset($account->{$phone_field}) || empty($account->{$phone_field}[LANGUAGE_NONE][0]['value'])) {
    return FALSE;
  }
  $phone_number = $account->{$phone_field}[LANGUAGE_NONE][0]['value'];
  return $phone_number;
}