You are here

function userpoints_filter_query in User Points 7.2

Same name and namespace in other branches
  1. 7 userpoints.module \userpoints_filter_query()

Filter a query according to the selected filters.

4 calls to userpoints_filter_query()
userpoints_admin_points in ./userpoints.admin.inc
Provides an administrative interface for managing points.
userpoints_admin_transactions in ./userpoints.admin.inc
Displays a list of transactions.
userpoints_list_transactions in ./userpoints.pages.inc
Displays a detailed transaction report for an individual user.
userpoints_list_users in ./userpoints.pages.inc
Lists the users and their point totals by all or by category.

File

./userpoints.module, line 1001

Code

function userpoints_filter_query(SelectQueryInterface $query, $values) {

  // Checks for filtering. isset() is used because 0 is a valid value
  // (Uncategorized).
  if (isset($values['tid']) && $values['tid'] != 'all') {

    // If a category is selected, limit both the default query and the query
    // that displays pending points to this category.
    $query
      ->condition('p.tid', (int) $values['tid']);
    $categories = userpoints_get_categories();
    return $categories[$values['tid']];
  }
}