After installing the dev version of the views_hacks module I ran into errors with the Views Filters Selective component. I traced it to the database prefix not being added.

I made an edit to the views_filters_selective.module which seemed to fix the problem.

Before (line 183)

if ($filter->view->base_table == 'node' && in_array('vid', array_keys($schema['fields']))) {
    $result = db_query("SELECT DISTINCT(t.$field_name) FROM {$table_name} t INNER JOIN {node} n ON t.vid = n.vid WHERE t.{$filter->view->base_field} IN (%s)", implode(',', $oids));
  }
  else {
    $result = db_query("SELECT DISTINCT($field_name) FROM {$table_name} WHERE {$filter->view->base_field} IN (%s)", implode(',', $oids));
  }

After

if ($filter->view->base_table == 'node' && in_array('vid', array_keys($schema['fields']))) {
    $result = db_query("SELECT DISTINCT(t.%s) FROM {%s} t INNER JOIN {node} n ON t.vid = n.vid WHERE t.{$filter->view->base_field} IN (%s)", $field_name, $table_name, implode(',', $oids));
  }
  else {
    $result = db_query("SELECT DISTINCT(%s) FROM {%s} WHERE {$filter->view->base_field} IN (%s)", $field_name, $table_name, implode(',', $oids));
  }

Comments

infojunkie’s picture

Status: Needs review » Fixed

Great catch, thanks! I fixed it a little differently than here, so please try it 12 hours from now and let me know if it works for you.

easp’s picture

Tested latest dev version and appears to be working fine.

Thanks! . . . and great module. I use it a lot.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.