function domain_user_lookup in Domain Access 6.2
Same name and namespace in other branches
- 5 domain_user/domain_user.module \domain_user_lookup()
Check to see if a user has created a domain record
Parameters
$uid: The user id of the domain to be checked. Optional.
$name: The username of the domain to be checked. Optional.
$domain_id: The domain_id taken from {domain}. Optional.
$clear: A boolean flag to clear the static variable if necessary. Not used. Here for consistency.
2 calls to domain_user_lookup()
- domain_user_init in domain_user/
domain_user.module - Implement hook_init()
- domain_user_user in domain_user/
domain_user.module - Implement hook_user()
File
- domain_user/
domain_user.module, line 343 - Creates unique subdomains for registered users.
Code
function domain_user_lookup($uid = NULL, $name = NULL, $domain_id = NULL, $clear = FALSE) {
if ($uid) {
$id = db_result(db_query("SELECT domain_id FROM {domain_user} WHERE uid = %d", $uid));
}
else {
if ($name) {
$id = db_result(db_query("SELECT du.domain_id FROM {domain_user} du\n INNER JOIN {users} u ON du.uid = u.uid\n WHERE u.name = '%s'", $name));
}
else {
if ($domain_id) {
$id = db_result(db_query("SELECT domain_id FROM {domain_user} WHERE domain_id = %d", $domain_id));
}
}
}
if (!empty($id)) {
$return = domain_lookup($id);
}
else {
$return = -1;
}
return $return;
}