Closed (fixed)
Project:
Flag
Version:
6.x-2.x-dev
Component:
Flag core
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
23 Mar 2010 at 13:21 UTC
Updated:
20 Dec 2010 at 12:50 UTC
Jump to comment: Most recent file
Continuing the work from #340031: Make real private flags usable by only the user creating the flag, this patch (against 6.x-2.0-dev) makes the 2 changes needed for the flag_custom module.
1. Add a hook_flag_delete() so that other modules can be notified before a flag is deleted.
2. Wrap the flag_get_flags() query in db_rewrite_sql() so other modules can restrict which flags are loaded if necessary for performance or other reasons.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | flag.inc_.patch | 624 bytes | awolfey |
| #7 | flag.inc_.patch | 722 bytes | awolfey |
| #5 | flag_custom.tar_.gz | 7.86 KB | awolfey |
| #4 | flag.patch | 1.54 KB | awolfey |
| flag-2.patch | 1.62 KB | awolfey |
Comments
Comment #1
awolfey commentedContinuing the discussion, I agree that the arg checking in the rewrite of the query is hacky. I thought about a hook_get_flags where flag could let other modules tell flag what to load, but that would mean flag would have to pass the context in which the flags are being loaded.
That seemed like a pretty big api change that is probably not worth it.
It might, however, prevent some other duplication. As it is, with the query rewrite, I'm probably going to have to duplicate some of the views integration.
I think this patch works well enough to leave the rest alone.
Thanks for your help with this.
Comment #2
seehawk commentedSubscribing.
Comment #3
quicksketchI'm fine with this patch but I'd like to see some product or benefit we gain from it in #340031: Make real private flags usable by only the user creating the flag.
Other than that, I can't see why we're using module_invoke() here instead of module_invoke_all(), seems like there's no reason for the manual looping.
Comment #4
awolfey commentedHere is the updated patch.
Comment #5
awolfey commentedAttached is the flag_custom module. Requires the patch in #4. See config settings under admin/build/flags/custom
Todo #859822: Views integration for private flags module
Comment #6
awolfey commentedThe latest code is here: http://drupal.org/project/flag_lists
Comment #7
awolfey commentedHere is a new version of the patch. Use this one if you are testing http://drupal.org/project/flag_lists .
Comment #8
quicksketchHey awolfey thanks for the update! Normally when delete hooks are called, they're done after the DELETE queries by the main module. See:
http://api.drupal.org/api/function/node_delete/6
http://api.drupal.org/api/function/comment_delete_multiple/7
Would flag_lists still operate if the module_invoke_all() came after the DELETE queries?
Comment #9
awolfey commentedYes, as long as $flag is available it can go after the queries.
Comment #10
awolfey commentedHere's a new patch.
Comment #11
maxxer commentedHi all,
I am really keen to try and test this out. However, a bit confused by the production timeline.
-->Should i still be getting flags 2 beta module from the flags page?
i.e. is flags_custom a modified version of flags 2, or an add-on module?
--> I assume i need patch #10, applied to flags 2 / flags_custom
--> do I still need #4 applied to flags 2 / flags_custom ?
I notice #4 patch has entries for .inc and .module. so I assume #4 must be applied before #10
For those of us just beginning to follow the action, a really quick summary for which packages/patches to go after would be really appreciated.
thanks for your efforts awolfey + quicksketch. Can't wait to (try!) and get this working.
Comment #12
awolfey commentedmaxxer, please see http://drupal.org/project/flag_lists
Comment #13
maxxer commentedthanks awolfey, that was indeed the page which led me indirectly to this one.
please excuse me, I do not intend to clutter the thread, but for anyone else trying to get up to speed:
I downloaded and installed
flag 2 beta
-->http://drupal.org/project/flag
flag lists
-->http://drupal.org/project/flag_lists
flag-custom module--> from comment #5
applied patch from #10 and #4 to flag module
working well here!
Comment #14
awolfey commentedmaxxer: You don't need flag_custom. It is replaced by flag_lists. You should uninstall flag_custom and delete it.
Comment #15
maxxer commentedthanks. again, I do not wish to clutter the issues thread, can i ask where is the best place to ask a question about using views with flag lists? I've posted to the general forum 'post-installation' but i think it will get lost in the chaos.
Comment #16
awolfey commentedThe best place to ask about flag_lists is in the flag_lists issue queue: http://drupal.org/project/issues/flag_lists
Comment #17
awolfey commentedI see we missed getting this patch into beta4. What can I do to help get it into dev and the next relase?
Comment #18
mooffie commented(It wasn't intentional. I'll commit it tomorrow. Nate, you see anything wrong with the patch?)
Comment #19
quicksketchI think this patch is a good idea, if it looks good to you please commit. Thanks as always mooffie.
Comment #20
mooffie commentedCommitted.
http://drupal.org/cvs?commit=459764
http://drupal.org/cvs?commit=459762
Comment #21
awolfey commentedThanks mooffie!