function sbp_users_sbp_query_modify in Search by Page 7
Same name and namespace in other branches
- 6 sbp_users.module \sbp_users_sbp_query_modify()
Implements Search by Page hook_sbp_query_modify().
Adds an access permission check to the search query.
File
- ./
sbp_users.module, line 95 - Module file for Search by Page Users, a sub-module for Search by Page.
Code
function sbp_users_sbp_query_modify($environment, $query) {
// User profile access is simple yes/no wholesale permission.
$ok = user_access('access user profiles');
$cond = db_and();
if ($ok) {
// If they can access users in general, join to user table to make
// sure user still exists and isn't blocked.
$query
->leftJoin('users', 'sbpu_u', 'sbpu_u.uid = sp.modid');
$cond
->condition('sbpu_u.status', 1);
}
else {
$cond
->where('0=1');
}
return $cond;
}