You are here

function sbp_users_sbp_query_modify in Search by Page 6

Same name and namespace in other branches
  1. 7 sbp_users.module \sbp_users_sbp_query_modify()

Implementation of Search by Page hook_sbp_query_modify().

Adds an access permission check to the search query.

File

./sbp_users.module, line 89
Module file for Search by Page Users, a sub-module for Search by Page.

Code

function sbp_users_sbp_query_modify($environment) {

  // User profile access is simple yes/no wholesale permission.
  $ok = user_access('access user profiles');
  $where = 0;
  $join = '';
  if ($ok) {

    // If they can access users in general, join to user table to make
    // sure user still exists and isn't blocked.
    $join = 'LEFT JOIN {users} sbpu_u ON sbpu_u.uid = sp.modid';
    $where = 'sbpu_u.status = 1';
  }
  return array(
    'where' => $where,
    'join' => $join,
    'arguments' => array(),
  );
}