function twilio_verify_number in Twilio 7
Determines if a number is associated with a user account.
@results bool TRUE or FALSE based on query
Parameters
int $number: The phone number we are searching for
bool $return_user: Boolean flag to return a user object if TRUE
2 calls to twilio_verify_number()
- twilio_register_validate in ./
twilio.user.inc - Custom validation function for phone numbers during registration.
- twilio_rules_condition_number_belongs_to_user in ./
twilio.rules.inc - Condition: Validate if a number belongs to a user on the site.
File
- ./
twilio.module, line 500 - Twilio module
Code
function twilio_verify_number($number, $return_user = FALSE) {
$result = db_select('twilio_user', 't')
->fields('t')
->condition('t.number', $number)
->condition('t.status', TWILIO_USER_CONFIRMED)
->execute()
->fetchAssoc();
if (!empty($result['uid'])) {
if ($return_user) {
return user_load($result['uid']);
}
return TRUE;
}
return FALSE;
}