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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kate’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, nodequeue_rules_event.patch, failed testing.

teleted’s picture

Status: Needs review » Needs work

This looks like a great start and I hope you resubmit. I'd like to suggest including an event for the creation of a queue.

jcmarco’s picture

Status: Needs work » Needs review

nodequeue_rules_event.patch queued for re-testing.

tanc’s picture

Very interested in this functionality as it would open up all sorts of automated actions for nodequeues based on different conditions.

delykj’s picture

+1

qpro’s picture

+1

qpro’s picture

After 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.

qpro’s picture

Sorry my fault, succesfully patched with GnuWin 32 http://drupal.org/node/99903

soulfroys’s picture

Thanks 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)

kirkcaraway’s picture

Very 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.

tanc’s picture

I'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).

tanc’s picture

Amended 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.

carn1x’s picture

subscribe

pirog’s picture

full patch rerolled against most recent dev.

cursor’s picture

This patch doesn't seem to work. Attached a watchdog event to check. Nothing :(

amateescu’s picture

Status: Needs review » Needs work

Have you tried it with latest 6.x-2.x-dev?

delykj’s picture

latest patch not works for latest module version (6.x-2.11)

Hunk #1 FAILED at 53.
Hunk #2 FAILED at 81.

pirog’s picture

patch from 15 was against current dev (6.x-2.x-dev) at time of posting. may no longer be applicable.

damiandab’s picture

subscribing

kasperg’s picture

Status: Needs work » Needs review
FileSize
3.03 KB

The 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:

  • Rules events are triggered through existing nodequeue hooks where possible instead of altering page callbacks
  • Event names are based on machine names instead of qids

.

gnindl’s picture

When dealing with a lot of nodequeues it would be better to have generic events like:

  • Node has been added to a nodequeue
  • Node has been removed from a nodequeue
  • Nodequeue has been updated
  • A nodequeue's node has been updated

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.

Joe Huggans’s picture

Anyone know how to go about automatically populating a node queue whenever a certain node type is created in Drupal 7?

Joe Huggans’s picture

mikl’s picture

I've updated the patch from #22 for the 2.x branch as well as the 2.11 release.

AparnaPC-1’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
Assigned: Unassigned » AparnaPC-1
Status: Needs review » Patch (to be ported)

this patch doesn't seem towork..!!!!!!!!!

mikl’s picture

Version: 7.x-2.x-dev » 6.x-2.x-dev
Assigned: AparnaPC-1 » Unassigned
Status: Patch (to be ported) » Needs review

This 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.

sambonner’s picture

Version: 6.x-2.x-dev » 7.x-2.x-dev
FileSize
7.79 KB

Hi, 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

jpstrikesback’s picture

Issue summary: View changes
FileSize
9.03 KB

A 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 ^^

Alex Bukach’s picture

Passing objects into events is fixed for 2 events.

dsoini’s picture

I 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.

Alex Bukach’s picture

dsoini, 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.

sambonner’s picture

#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.

eugene.ilyin’s picture

Status: Needs review » Reviewed & tested by the community

Patch #33 works for me. Thank you!

  • fizk committed b66cb03 on 7.x-2.x authored by sambonner
    Issue #952448 by tanc, mikl, sambonner, Alex Bukach, pirog, jcmarco,...
fizk’s picture

Status: Reviewed & tested by the community » Fixed

Works like a charm! Great work.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.