You are here

function advuser_admin_filters in Advanced User 5

3 calls to advuser_admin_filters()
advuser_admin_filter_form in ./advuser.module
advuser_admin_filter_form_submit in ./advuser.module
advuser_admin_user_build_filter_query in ./advuser.module

File

./advuser.module, line 69

Code

function advuser_admin_filters() {
  $filters = array();

  // Regular filters
  $filters['email'] = array(
    'title' => t('E-mail'),
    'where' => "u.mail = '%s'",
  );
  $filters['uid'] = array(
    'title' => t('User Id'),
    'where' => "u.uid = '%s'",
  );
  $filters['access'] = array(
    'title' => t('Last Access'),
    'where' => "u.access = '%s'",
  );
  $filters['status'] = array(
    'title' => t('Status'),
    'type' => t('selection'),
    'options' => array(
      0 => t('Blocked'),
      1 => 'Active',
    ),
    'where' => 'u.status = %s',
  );
  $fields = variable_get('advuser_profile_fields', ADVUSER_DEFAULT_PROFILE_FIELDS);
  if (is_array($fields)) {
    foreach ($fields as $fid => $value) {
      if ($value) {
        $field = db_fetch_object(db_query('SELECT * FROM {profile_fields} WHERE fid = %d', $fid));
        $options = array();
        if ($field->type == 'selection') {
          $result_v = db_query('SELECT DISTINCT * FROM {profile_values} WHERE fid = %d', $field->fid);
          while ($value = db_fetch_object($result_v)) {
            $options[$value->value] = $value->value;
          }
        }

        // Regular filters
        $filters[$field->fid] = array(
          'title' => $field->title,
          'type' => $field->type,
          'options' => $options,
          'field_where' => 'pf.fid = ' . $field->fid . ' AND pv.value = ' . "'%s'",
        );
      }
    }
  }
  advuser_module_invoke('filter', $filters);
  return $filters;
}