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.
On the administer>>content page: While "status" and "type" filters seem to work fine, the "category" filter doesn't have any affect.
-jeff
Comment | File | Size | Author |
---|---|---|---|
#32 | node.module_26_0.patch | 7.15 KB | Zen |
#30 | node.module_26.patch | 7.15 KB | Zen |
#26 | node.module_23.patch | 7.15 KB | Zen |
#23 | node_admin_3.patch | 6.12 KB | chx |
#22 | node_admin_2.patch | 6.21 KB | chx |
Comments
Comment #1
Zen CreditAttribution: Zen commentedPatch attached. Please review.
Thanks
-K
Comment #2
Zen CreditAttribution: Zen commentedI just realised that I hadn't tested nested hierarchies.. and it broke :/
Patch recalled.
-K
Comment #3
Zen CreditAttribution: Zen commentedFalse alarm. The original patch still applies.
However, the "category is [category name]" is still b0rked. This is due to the same nested array issue as with the actual filter issue (fixed with the above patch). Reasons why fixing this is icky are:
-The options will again have to be flattened. However, form_options_flatten only returns the keys and not the values [returns 1 for values].. The values are what we want here..
-Even if a new flattening function is added which preserves both keys and values and their association, the actual values for the category options are prefixed with "----"s for indicating hierarchy..
-Last option, is to use form_options_flatten and get the keys/tids and load the taxonomy term using that.. But this would imply a check for $type=='category', which is again going to make things ugly..
This filter also breaks when the filter is refined to check for multiple categories.. The JOINs are broken..
I will look at this later, but for now please review the above patch..
Thanks
-K
Comment #4
Zen CreditAttribution: Zen commentedPatch attached:
-fixes the JOIN issues for the category node filter. Nodes with multiple parents can now be filtered successfully.
-displays the category name by loading the taxonomy term. I couldn't think of a cleaner solution for this..
Reviews appreciated :)
Thanks
-K
Comment #5
Zen CreditAttribution: Zen commentedtaxonomy_get_term -> module_invoke('taxonomy', 'get_term');
Cheers,
-K
Comment #6
tomsys CreditAttribution: tomsys commentedThanks,
how soon this will get commitedt to thead HEAD .. ?
T.
Comment #7
chx CreditAttribution: chx commentedas soon as someone tests it throughly. for example, do combined filters work? various taxonomy options?
I read the code and found it good (I suggested calling the taxonomy through module invoke).
Comment #8
tomsys CreditAttribution: tomsys commentedOk,
Thanks for this one, patched and now testing so far everything works as it should.. will live with this one for a while :) as far as I understood it doesn't affect any of existing content it only works as a filter for getting faster to the existing content and there wont be any possible damage...
T.
Comment #9
riccardoR CreditAttribution: riccardoR commentedOk,
Thank you for the good work. I tested the patch with combined filters and various taxonomy options; it works properly so far.
While you are changing node_filter() :
..what about cleaning it a little more? I see no side-effects to this :
Shanti,
rR
Comment #10
Zen CreditAttribution: Zen commented@Riccardo: Done - thanks :)
Please re-review.
-K
Comment #11
riccardoR CreditAttribution: riccardoR commented@zen: I have found another problem.
Category selection doesn't show up free tagging vocabularies. Same problem on node advanced search.
The fix is easy (on node.module):
rR
Comment #12
Dries CreditAttribution: Dries commentedis a hack IMO! :/
Comment #13
Zen CreditAttribution: Zen commented@Riccardo: Another good catch :) I'll add a patch shortly.. btw you don't have to wait for me to do this.. Feel free to attach your own, or even open a new issue for it :)
@Dries: Well, this was the _neatest_ solution I could come up with. It was either this or appending a %d to the string after the first sprintf. Any ideas?
Thanks for the reviews :)
-K
Comment #14
riccardoR CreditAttribution: riccardoR commentedA new patch with all modification made by Zen, plus :
- the changes proposed on #11 to fix free tagging
- a different approach to table aliases using a token ('tn#') and str_replace() to append a counter to tn alias. Is this acceptable?
Please review.
rR
Comment #15
chx CreditAttribution: chx commentedOK guys, I fix this and then go to sleep.
Comment #16
chx CreditAttribution: chx commentedriccardoR, putting $foo =1 into a function call parameter is not really elegant, and mostly totally unnecessary. If you need to assign $foo 1 , do it before the call, and use $foo as parameter. If you do not need to do that then simply use 1 as parameter. drupaldocs shows the definition headers not the call.
Comment #17
chx CreditAttribution: chx commentedfolks, thanks for the hard work. All I needed to do was some minor code cleanup. node_filters stored SQL -- but it was used only in node_build_filter_query so I simply moved the queries to their place. Then I grabbed the $index which was available from foreach and created the category queries with it. Similar technique can be found in taxonomy_select_nodes. No need for $i and increasing it.
I also found that in node_filters $filters['category']['options'] was given a value twice. This let me delete some code.
Comment #18
chx CreditAttribution: chx commentedAnother minor removal, this time from an earlier attempt of mine :)
Comment #19
chx CreditAttribution: chx commentedAnd finally, some comments.
Comment #20
moshe weitzman CreditAttribution: moshe weitzman commentedi teste and code reviewed the most recent patch. code looks real nice and works as promised. nice work everyone.
Comment #21
Zen CreditAttribution: Zen commented+1 Excellent work chx :)
Cheers
-K
Comment #22
chx CreditAttribution: chx commentedI removed two blank lines and $i = 0 which is unused. No need to retest.
Comment #23
chx CreditAttribution: chx commentedAnd now, the correct patch :(
Comment #24
venkat-rk CreditAttribution: venkat-rk commentedDrupal gurus,
Any chance this patch will work on a 4.6 site or is the code more for 4.7? I am using hundreds of terms on a site, so the ability to filter by category is crucial for me as admin.
Also, any chance this will be tagged for 4.6.5? That would be a real bonus.
Comment #25
Dries CreditAttribution: Dries commentedIs 'exploit hole' proper English? I sounds so ... nevermind.
Comment #26
Zen CreditAttribution: Zen commentedPatch attached:
-Exploit -> Exploitable
-Simplified node_filter array declaration
-[OT] Removed unused variable ($i) from node_revision_overview
@Ramdak - I have no idea, sorry.
-K
Comment #27
riccardoR CreditAttribution: riccardoR commented+1
@chx: Your revision is very clean and elegant. I have learned a lot here.
Thanks everyone.
rR
Comment #28
tomsys CreditAttribution: tomsys commentedThanks,
Checked this .patch and it seams to do all the tricks with even with many categories and many AND ... AND .. levels plus free tagging is now working as well.. this is realy good one.
T.
Comment #29
tomsys CreditAttribution: tomsys commentedHello Folks,
Now, when filtering is working fine and flawless.. I think that there is still a small improvement needed.. when building a category dropdown list then probably it would be a good idea to exclude from there non used categories... I mean if there is no single node in that category, then it's wise not to show that category at all in category filter dropdown menu ..
This is just to add as comment here before this .patch will be rolle out into the HEAD..
T.
Comment #30
Zen CreditAttribution: Zen commentedFixed //.
-K
Comment #31
Dries CreditAttribution: Dries commentedI leave this for Steven to review and commit; he wrote the original code and is best placed to review this.
The $table/$index code looks a bit weird to me.
Comment #32
Zen CreditAttribution: Zen commentedFixes missed //. Patch directly edited.
-K
Comment #33
Steven CreditAttribution: Steven commentedI committed the patch with improved comments, but the free tagging issue IMO needs to be addressed.
Free tagging vocabularies tend to be very large and would make the page very long to load. The advanced search has a similar problem though. The only thing that springs to mind is to use an autocomplete-based mechanism for large/free tagged vocabularies.
Comment #34
(not verified) CreditAttribution: commented