Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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
Comment #1
infojunkieGreat 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.
Comment #2
easp CreditAttribution: easp commentedTested latest dev version and appears to be working fine.
Thanks! . . . and great module. I use it a lot.