Download & Extend

Change term of a node after some weeks to archive it

Project:Rules
Version:6.x-1.4
Component:Rules Engine
Category:support request
Priority:normal
Assigned:Unassigned
Status:postponed

Issue Summary

Hi

i'm using a vocabulary to order node content between new content tagged with "actuality" and older tagged with "archive".

I would to do that automatically with rules.So i need to make a comparison between the publication date and the current date, then if the difference is 12 weeks for exemple, i would rules change the terme "actuality" to "archive" when the cron run.

So how can i specify the publication date in the numeric comparison ? and more geenrally to make this rules to work..

thanks

Comments

#1

Status:active» fixed

You can do this by using the Rules Scheduler module.

This doesn't really work the way you describe – it won't compare the current date with the node post date – but you can schedule a rule set to be executed at a later point in time. Thus you can have a rule set setting a tag "archive" to a node, and then have the rule set executed 12 weeks after the node has been created.

There are some screencasts showing how to use Rules Scheduler here: http://nodeone.se/blogg/learn-rules-screencast-series-summed-up

Good luck!
//Johan Falk, NodeOne, Sweden
PS: I'm not maintaining the Rules module, just helping with support questions. You are welcome to ask more questions at http://groups.drupal.org/rules

#2

i created a rules set, like this :
rules settings : rule custom label
event : after new node saving

Rules elements :
if => New created content
do => change taxonomy term and archive scheduled (+45 days)

is it good ? this rules run on cron or i must to create an action ?

thanks

#3

I'm not sure how to interpret what you have done. Rule sets don't have any triggering events – they must be called by triggered rules (or some other part of Drupal).

I suggest:
* A rule set that takes a node as an argument, loads a specific taxonomy term, and then sets the taxonomy term on the node.
* A triggered rule that reacts on new content created, and schedules the rule set above in +45 days.

Good luck,
//Johan Falk

#4

this is my actual rules, i export from my drupal install.what do you think about ?

AttachmentSizeStatusTest resultOperations
rules-archivage.txt3.93 KBIgnored: Check issue status.NoneNone

#5

I'm sorry, but I can't install and test the rules configuration – it takes too much time.

There is a pretty good screencast series on how to use Rules Scheduler (and Rules in general) at http://nodeone.se/blogg/learn-rules-screencast-series-summed-up. I hope it can be of help.

//Johan Falk

#6

ok i'll try to see screencast and hope to use it to modify my rules set...keep in touch

#7

Status:fixed» closed (fixed)

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

#8

tried your tuto but i don't understand the logic of rules, so it's hard to me to make one..it's simple in my mind but not so on drupal...if you know about basic explaination on rules tell me...thanks

#9

Status:closed (fixed)» active

ok back in town...
i better understand rules...but i don't find where to put the time argument ? in the rule i guess...
actually i've a rule with :

SI (if)
condition
Contenu créé est nouveau indent

FAIRE (do)
action
Charger un terme : ajouter terme Archiver

so i guess i could add a condition on the time/date..not ?

EDIT: ok i understand more and i've made a rule set , that i want to trigger in a triggered rules...but in action i can"t select my rule set...why ? my rule set have an active rules inside..

#10

Status:active» fixed

@aiphes: Have you checked out the videos on Rules Scheduler? They explain this much better than I can do in text. If the videos still leaves questions unanswered, feel free to post more detailed questions here.

#11

yes i saw them...but i try a single rule,to see if it works..how can i check rule work well ?

#12

What you have to do is to schedule the component – not call it directly.

#13

ok find what's wrong

Planifier "Regles sur le contenu (rule_set)"
Argument indisponible : Terme de taxonomie
=> Argument unavaiable : Term

but i've put in the ruleset an argument Terme de taxonomie(Term) as "Associate term to content" ,perhaps i need to choose other one like "Load Term" ...i've read about the need to load term before associate it ..no ?

but i can't reuse the argument

Une variable avec ce nom existe déjà. Veuillez choisir un autre nom.
=> variable still exist with this name.Choose another name.

#14

Status:fixed» active

ok i'm not so far...i've created a ruleset with an action to check the "age" of content then charge a terme and assign it to the content...but i've some issue:

- what the token to have the number of days since content creation ?actually i've just the number of the day...??
- how can i do that this ruleset applied to all older content, no simply the edited content that trigger the rule ?

thanks

EDIT: i found the token to have the laptime since node creation : [node:since] , but how to compare it ? actually i've :

[node:since] Greater than 8 weeks but perhaps the language is important and i do to write it in french ?

#15

Status:active» fixed

aiphes: Use the "schedule component" action! It will make the task much easier.

It would look something like this:

* Rule component (takes a node as parameter):
- check that content is of the proper type
- add the tag to the node
- change the state of the node to archived

* Reaction rule, acts on new node created:
- check that content is of the proper type
- schedule Rules component (the component above)
+ as the node parameter, select the node being saved
+ as time, set "+12 weeks" (or something)

When a new node is created, a task will be scheduled to archive it in 12 weeks. The component won't have to check any age of the node at all – it is executed 12 weeks from the creation time and just does its job.

Here's another link to the screencast series that explains how to use Rules Scheduler: http://vimeo.com/29554336

Good luck!

(Closing this issue again, since I view the point of the issue to be to direct to documentation – not to complete a given task. Reopen if there are particular problems, and I'll try help finding more specific docs.)

#16

Status:fixed» active

ok , i try to understand because i'm using rules 6.xx with translated interface in french..in your video i see that on D7 version, so i don't have the component rules page...

so this is what i do:

1- creating a ruleset with node argument, named "Content ruleset"
adding a rule with : IF elapsed time from node creation DO charge a term then apply it to the node

2- creating a trigger rule : IF content type is TRUE DO Schedule the "Content ruleset" with arg : content updated ; identifier : Noeud : "[node:nid]" - Créé il y a [node:since] et modifié il y a [node:mod-since] ; schedule eval date : +120 seconds (FOR TEST)

so if i edit a node, i've this message :

0 ms "Après mise à jour d'un contenu existant" a été invoqué.
0.142 ms Exécute la règle "Déclencheur archivage" du groupement "Après mise à jour d'un contenu existant".
0.442 ms Condition "Contenu mis à jour est Page Innovations (VdL) ou Page Intervenants (VdL) ou Page Projets (VdL) ou Page Revue de Presse (VdL) ou Page Sorties-Actions (VdL)" évaluée à TRUE.
435.984 ms Exécution de l'action : "Planifier "Regles sur le contenu (rule_set)""
456.616 ms L'évaluation de "Après mise à jour d'un contenu existant" est terminée.

for me the issue is on taxonomy,because the trigger seem to work ,no ?
EDIT : it works with a new ruleset where for actions i charge terms needed and i assign/delete terms if content is 8 weeks age old minimum...the next step is to apply my rule for all older content...actually only the term of edited node is modify...i saw the ability to apply the rule to modified content or unmodified content, so could i add 2 actions in triggered rules for my ruleset ?

#17

There should be no condition checking the age of the node – you should just schedule an action/rule set to be executed at a certain time.

Here are some screencasts for Rules in Drupal 6: http://dev.nodeone.se/node/634
I hope they can be of help.

#18

ok so i do a ruleset with rule that take only action, no condition, then i create a triggered rule that schedule the ruleset above at a certain time..right ?

but checking the age of content is possible no ? perhaps too complex to begin...

#19

Status:active» fixed

#18: Correct!
It may be possible to check the age of the content, but there is really no need. You can schedule the rule set to be executed at "creation date" + 21 days, or use other tokens to set a suitable date.

#20

ok i get it !! :) i didnt know that i could use token + time....great i go to try it right now
so does exist a difference between non modified content and modified content to apply the triggered rule ?
does i need to make 2 different rules to apply the same ruleset on both type of content ?

#21

@aiphes: I would use two different rules – one after saving new content, one after updating existing ones. You could, almost, use the event triggered whenever any content is about to be saved – but at that event new nodes don't have any node IDs (which are good for creating task IDs).

But you can still call the same rule set from both triggered rules.

Good luck!

#22

Status:fixed» closed (fixed)

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

#23

Status:closed (fixed)» active

i've a new need linked to this, how can i give the choice of duration of a publicated content to automatically change term after the date choosen by user or after duration choosen by user ? in my idea via a select box in the content type..then ?

in my mind, the user could choose a tag for the content like "highlighted", then choose a date for the end validate duration for this tag, and the tag will be change automatically by rules.is it clear ?

EDIT: for this i can use conditonal fields and Content taxonomy but i can't control the date field with the taxo field..

thanks for your tips or experience

#24

Status:active» fixed

1: It is generally better to start a new issue for a new question – in that way it will be easier for others to find questions and answers.

2: To solve this problem, I suggest using a Date field, and using that field to schedule the execution of the component that changes the tag. (The date field can be used with "data selection" to set the execution time of the component!)

I hope this makes it more clear. Good luck!

#25

Status:fixed» needs work

"data selection" => i must choose Data as argument on creating the ruleset so ?
then is it possible to modify arguments type in a ruleset after creating it ? because actually it seem to be impossible..i could create another one if i forget to choose one of arguments..
and is it possible to see which type of argument is in use for a ruleset ?

thanks

#26

No no – not "data" as parameter for the rule set. That was just the way to enter the date value when scheduling the rule set.

These screencasts explain the Rules module quite well: http://dev.nodeone.se/node/984

Episode 2 covers "data selection", episode 6 components and episodes 14–16 covers Rules Scheduler. I hope they may help.

#27

ok so is it better to give the choice to user to :
- indicate the dead end date
- or indicate the starting date and arbitrary decide which time it is publish

#28

If you want the user to set both start and end date, then you can do that. You can schedule events for either, or both.

(Did you look at the screencasts? They explain this much better than I can do in text.)

#29

i start to look at screencast but i need time and i don't work on it in full time :( so i try to adapt tutos from drupal.org to my case..but seem to be old because no use of ruleset...i will post back when i will try to go on this because it's an important way to improve website i think

#30

Status:needs work» postponed

Right! Feel free to write back if you get stuck.