Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
Nodequeue only defines core actions that can be use with rules as actions, but adding rules events you can execute conditions and any rule actions after any change in a defined nodequeue.
This way you can, for example, show a message, alter fields in a referenced node, add/deduct userpoints, add events, .... when you add or remove a node from a nodequeue.
This patch defines two new events, for adding and removing a node from some of the defined nodequeues.
Comments
Comment #1
kate CreditAttribution: kate commentedComment #3
teleted CreditAttribution: teleted commentedThis looks like a great start and I hope you resubmit. I'd like to suggest including an event for the creation of a queue.
Comment #4
jcmarco CreditAttribution: jcmarco commentednodequeue_rules_event.patch queued for re-testing.
Comment #5
tancVery interested in this functionality as it would open up all sorts of automated actions for nodequeues based on different conditions.
Comment #6
delykj CreditAttribution: delykj commented+1
Comment #7
qpro+1
Comment #8
qproAfter apply de patch i got this error:
Parse error: syntax error, unexpected '<' in C:\Program Files\acquia-drupal\drupal\sites\all\modules\nodequeue\nodequeue.module on line 37.
Comment #9
qproSorry my fault, succesfully patched with GnuWin 32 http://drupal.org/node/99903
Comment #10
soulfroysThanks for this patch!
"Changes to Nodequeue when logged in do not propagate when logged out" (http://drupal.org/node/205992), so, a "onUpdate" event (plus Cache Actions) would be great for this task, isn't it?
Related issue:
"Per-queue page cache lifetime to be cleared on cron run." (http://drupal.org/node/293312)
Comment #11
kirkcaraway CreditAttribution: kirkcaraway commentedVery interested in having this functionality. Specifically, I'm looking at creating rules that would automatically remove nodes from specific nodequeues if they are added to other nodequeues. Thanks.
Comment #12
tancI've attached a patch against latest 6.x-2.x-dev includes the first patch and also adds an event for a nodequeue being saved. I'm not massively familiar with either nodequeue or rules so please check the patch and fix if need be.
An example of where this event is useful is: Flush the page cache on nodequeue save (when combined with the cache actions module).
Comment #13
tancAmended version above which wasn't working properly. This version is reacting to modifying the queue in the admin interface. So it won't trigger if you programatically save a queue, only through the gui. Let me know if this should be altered.
Comment #14
carn1x CreditAttribution: carn1x commentedsubscribe
Comment #15
pirog CreditAttribution: pirog commentedfull patch rerolled against most recent dev.
Comment #16
cursor CreditAttribution: cursor commentedThis patch doesn't seem to work. Attached a watchdog event to check. Nothing :(
Comment #17
amateescu CreditAttribution: amateescu commentedHave you tried it with latest 6.x-2.x-dev?
Comment #18
delykj CreditAttribution: delykj commentedlatest patch not works for latest module version (6.x-2.11)
Hunk #1 FAILED at 53.
Hunk #2 FAILED at 81.
Comment #19
pirog CreditAttribution: pirog commentedpatch from 15 was against current dev (6.x-2.x-dev) at time of posting. may no longer be applicable.
Comment #20
damiandab CreditAttribution: damiandab commentedsubscribing
Comment #21
kasperg CreditAttribution: kasperg commentedThe patch in #15 applied against 2.11 for me but the events were not triggered.
Here is a new patch partly based on #15. Changes:
.
Comment #22
gnindl CreditAttribution: gnindl commentedWhen dealing with a lot of nodequeues it would be better to have generic events like:
Then you could have a condition "Belongs to" filtering one or more nodequeues.
This way you can come up with a more generic configuration especially in combination with the cache_actions module.
Comment #23
Joe HuggansAnyone know how to go about automatically populating a node queue whenever a certain node type is created in Drupal 7?
Comment #24
Joe Hugganssee here http://drupal.org/node/1125922
Comment #25
mikl CreditAttribution: mikl commentedI've updated the patch from #22 for the 2.x branch as well as the 2.11 release.
Comment #26
AparnaPC-1 CreditAttribution: AparnaPC-1 commentedthis patch doesn't seem towork..!!!!!!!!!
Comment #27
mikl CreditAttribution: mikl commentedThis patch is currently for nodequeue 6.x-2.x. If you have tested it on that, and it doesn't work, please say what's wrong.
Comment #28
sambonner CreditAttribution: sambonner commentedHi, here's a first pass at a patch to add rules integration to nodequeue 7.x-2.x. Basically a port of the 6.x patch to handle changes to rules and token API's. Tested and working well on drupal 7 with latest nodequeue 7.x-2.x-dev branch. Not sure if I should create an seperate 7.x issue for this rather than hi-jacking the 6.x thread.
Suggestions for improvements welcome :)
Thanks,
Sam
Comment #29
jpstrikesback CreditAttribution: jpstrikesback commentedA few fixes: node objects are passed into events.
An addition: check if passed node belongs to a certain queue (the other belongs to queue condition simply checks the passed nodequeue itself)
EDIT: there are use cases for both conditions ^^
Comment #30
Alex Bukach CreditAttribution: Alex Bukach commentedPassing objects into events is fixed for 2 events.
Comment #31
dsoini CreditAttribution: dsoini commentedI tried applying patch #30 to a fresh copy of nodequeue but got an error when saving the queue reordering form. I reversed it and next I tried patch #29 and also got the error. I reversed that and applied Patch #28. #28 was successful. No error and my rule is triggered.
Comment #32
Alex Bukach CreditAttribution: Alex Bukach commenteddsoini, what error did you get? What nodequeue-related rules do you have?
Patch #29 introduces significant improvements (e.g. provides a new rules condition), I just fixed it a bit in #30. I think we should make it work instead of holding on #28.
Comment #33
sambonner CreditAttribution: sambonner commented#30 is throwing a RulesEvaluationException when a nodequeue is saved because when the nodequeue saved rule event is invoked from within nodequeue_save_subqueue_order() no nodes are passed. I've refactored slightly so that the event now takes an array of nids which are loaded into an array of node objects within the RulesDataWrapper class.
Comment #34
eugene.ilyin CreditAttribution: eugene.ilyin commentedPatch #33 works for me. Thank you!
Comment #36
fizk CreditAttribution: fizk commentedWorks like a charm! Great work.