Custom filter handler are still a common problem, if one uses views fusion.
This is because they often use add_where in conjunction with $filterinfo['table'] - which isn't aliased and can't be, as modules might want use $query->ensure_table(), which needs the unaliased table.
Only views_filter_handler_default manually applies the table alias, so this is working.

So I had a look at this all and how we could clean up this mess a bit.
-> I propose to make use of $query->get_table_name($table) on all tables, before they are added with add_where(). This adds the table alias prefix, if necessary.

Attached is a patch, which cleans the most common filter handlers, as well as all others I was able to find, that make use of add_where() with their tablename. I've tested all modified filters as well the default handler to work with and without views fusion.

As an affect it fixes
* all filters using views_handler_filter_like
* all filters using views_handler_filter_timestamp
* the File: Has file downloads filter
* the Node: Current User Authored or Commented filter

to work with views fusion too.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

fago’s picture

I forgot, it also fixes the
* Role: Author has Role filter.

merlinofchaos’s picture

Status: Needs review » Reviewed & tested by the community

I will commit this, but after 1.6 real.

mlncn’s picture

Subscribing.

In the thought that this might help with exposed filters not working as regular filters do.
http://agaricdesign.com/views-exposed-filters-and-range-filters-problems...

fago’s picture

FileSize
6.66 KB

@merlinofchaos: great!

I rerolled the patch so that it applies without fuzz again.

sun’s picture

Status: Reviewed & tested by the community » Needs review

I believe this patch needs some more positive test results to be RTBC, because it touches views core. I'm unsure whether Benjamin's follow-up was actually one.

sun’s picture

...and I mean positive test results from users having many views, contrib modules, and also at least one implementation of hook_views_tables_alter().

suit4’s picture

I use fused views, exposed filters and prefixed tables and got strange results in my fused views, whereass the fused-in view itself produced correct results.

You need more positives?

Well, take mine, this fixed my issue!

esmerel’s picture

Status: Needs review » Closed (won't fix)

At this time, only security fixes will be made to the 5.x version of Views.