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.
Comment | File | Size | Author |
---|---|---|---|
#4 | views_fusion_filter_2.patch | 6.66 KB | fago |
views_fusion_filter.patch | 6.64 KB | fago | |
Comments
Comment #1
fagoI forgot, it also fixes the
* Role: Author has Role filter.
Comment #2
merlinofchaos CreditAttribution: merlinofchaos commentedI will commit this, but after 1.6 real.
Comment #3
mlncn CreditAttribution: mlncn commentedSubscribing.
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...
Comment #4
fago@merlinofchaos: great!
I rerolled the patch so that it applies without fuzz again.
Comment #5
sunI 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.
Comment #6
sun...and I mean positive test results from users having many views, contrib modules, and also at least one implementation of hook_views_tables_alter().
Comment #7
suit4 CreditAttribution: suit4 commentedI 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!
Comment #8
esmerel CreditAttribution: esmerel commentedAt this time, only security fixes will be made to the 5.x version of Views.