You are here

function mobile_number_tfa_account_number in Mobile Number 7

Helper function for getting account mobile number for TFA, if applicable.

Parameters

int $uid: User id.

Return value

string Mobile number (international format).

2 calls to mobile_number_tfa_account_number()
MobileNumberTfa::ready in src/MobileNumberTfa.php
Determines whether TFA is applicable to the account.
MobileNumberTfa::__construct in src/MobileNumberTfa.php
MobileNumberTfa constructor.

File

./mobile_number.module, line 576
mobile_number.module

Code

function mobile_number_tfa_account_number($uid) {
  $user = user_load($uid);
  $field_name = variable_get('mobile_number_tfa_field', '');
  if (mobile_number_sms_sending_is_enabled() && variable_get('tfa_enabled', FALSE) && $field_name && !empty($user->{$field_name}['und'][0]['value']) && !empty($user->{$field_name}['und'][0]['tfa'])) {
    return $user->{$field_name}['und'][0]['value'];
  }
  return '';
}