Hello! Thanks for an amazing module!

I'm having trouble implementing the unpublish part of my publish/unpublish process... I have two datetime fields, one for the 'Publish date' and the other for the 'Unpublish date'. I've followed tutorials 2 and 3 and the publish functionality works wonderfully, but when I implement the unpublish rule set and triggered rule, the node that was publishing right on time previously, no longer gets published. It seems that as soon as I run cron at the time I've set it to publish, the unpublish rule immediately gets triggered, well before the time I specified.

I don't have a wonderful understanding of how the arguments are being applied, or exactly how this needs to be set up to get the functionality I'm looking for, but I would really appreciate a few hints : )

I'm debugging, and am receiving these messages:

Upon saving:

* o 0 ms "After saving new content" has been invoked.
o 0.066 ms Executing the rule "Schedule publishing by date field" on rule set "After saving new content"
o 0.195 ms Condition "Created content is Alert" evaluated to TRUE.
o 1.137 ms Action execution: "Schedule "Publish content {rule set}""
o 2.697 ms Evaluation of "After saving new content" has been finished.
* Alert A New Test Alert has been created.

Upon running cron after Publish date/time has passed, but Unpublish date has not:

* o 0 ms "Publish content {rule set}" has been invoked.
o 0.065 ms Executing the rule "Publish action {rule}" on rule set "Publish content {rule set}"
o 0.189 ms Action execution: "Publish content {action}"
o 3.048 ms Saved variable Content {argument} of type node.
o
+ 58.885 ms "After updating existing content" has been invoked.
+ 58.951 ms Executing the rule "Schedule publishing by date field on updating" on rule set "After updating existing content"
+ 59.077 ms Condition "Created content is Alert" evaluated to TRUE.
+ 59.56 ms Condition "Numeric comparison" evaluated to FALSE.
+ 59.613 ms Executing the rule "Schedule unpublishing by date field" on rule set "After updating existing content"
+ 59.718 ms Condition "Created content is Alert" evaluated to TRUE.
+ 59.809 ms Action execution: "Unpublish updated content"
+ 62.837 ms Action execution: "Schedule "Unpublish content {rule set}""
+ 64.63 ms Saved variable updated content of type node.
+
# 106.609 ms "After updating existing content" has been invoked.
# 106.671 ms Not executing the rule "Schedule publishing by date field on updating" on rule set "After updating existing content" to prevent recursion.
# 106.718 ms Not executing the rule "Schedule unpublishing by date field" on rule set "After updating existing content" to prevent recursion.
# 106.757 ms Evaluation of "After updating existing content" has been finished.
+ 116.092 ms Evaluation of "After updating existing content" has been finished.
o 121.69 ms Evaluation of "Publish content {rule set}" has been finished.
* Cron ran successfully.

At this point, the node remains unpublished, but I would like it to be published.

After Unpublish date has passed, and after running cron again, I receive these messages:

* o 0 ms "Unpublish content {rule set}" has been invoked.
o 0.07 ms Executing the rule "Unpublish action {rule}" on rule set "Unpublish content {rule set}"
o 0.204 ms Action execution: "Unpublish content {action}"
o 2.636 ms Saved variable Content {argument} of type node.
o
+ 141.834 ms "After updating existing content" has been invoked.
+ 141.906 ms Executing the rule "Schedule publishing by date field on updating" on rule set "After updating existing content"
+ 142.036 ms Condition "Created content is Alert" evaluated to TRUE.
+ 142.589 ms Condition "Numeric comparison" evaluated to FALSE.
+ 142.643 ms Executing the rule "Schedule unpublishing by date field" on rule set "After updating existing content"
+ 142.757 ms Condition "Created content is Alert" evaluated to TRUE.
+ 142.918 ms Action execution: "Unpublish updated content"
+ 184.186 ms Action execution: "Schedule "Unpublish content {rule set}""
+ 245.873 ms Saved variable updated content of type node.
+
# 289.301 ms "After updating existing content" has been invoked.
# 289.372 ms Not executing the rule "Schedule publishing by date field on updating" on rule set "After updating existing content" to prevent recursion.
# 289.421 ms Not executing the rule "Schedule unpublishing by date field" on rule set "After updating existing content" to prevent recursion.
# 289.462 ms Evaluation of "After updating existing content" has been finished.
+ 327.949 ms Evaluation of "After updating existing content" has been finished.
o 333.578 ms Evaluation of "Unpublish content {rule set}" has been finished.
* Cron ran successfully.

I know where I started going wrong... when I created the Unpublish rule set and triggered rule, I followed the steps for creating the publish rule in tutorials 2 and 3, but replaced every instance of the word or command "publish" to "unpublish". I'm sure that I need to be more specific, but I'm unsure where to start.

Below was my methodology for creating the unpublish action (straight from the tutorials, but changed to "Unpublish"):

Unpublish rule set:

3. Go to "admin/rules/rule_sets" and click on the tab "Add a new rule set".
4. Fill out the label for example with "Unpublish content {rule set}" and the machine-readable name with "unpublish_content".
5. In the "Arguments" fieldset fill out the first row: select "Content" as data type, enter "Content {argument}" as the label and "unpublish_content__content" as the machine-readable name.
6. Now confirm your input by clicking the "Save" button.
7. You are redirected now to the rule sets overview page and your freshly created rule set is listed.
8. Click on it ("Unpublish content {rule set}" was the name) and add a new rule by clicking the "Add new rule" tab.
9. Fill out the label of the new rule with "Unpublish action {rule}" and click on "Save changes".
10. You are now on the edit page of this rule and we want to add an action by clicking on "Add an action".
11. You get a select box where you need to select "Node|Unpublish content" (NOT "Rule Set|Unpublish content"!) and confirm it by clicking on "Next".
12. We leave the details of the action unchanged on the received form, because the argument is already selected correctly (we had only "Content {argument}" specified as argument), except for changing the action label from "Unpublish content" to "Unpublish content {action}" to make it easier to track.
13. Hit "Save".

Unpublish triggered rule:

* Go to "admin/rules/trigger" and add a new rule.
* The process will be very similar to the example in Tutorial 2.
* The rule label should be something like "Schedule unpublishing by date field" and the event must be "After saving new content". Here I tried "After saving new content", which didn't work, and "After updating existent content", which is reflected in my debugging log above.
* Add a condition "Content has type" to verify that we only act on our previously added content type.
* Now add an action, select "Schedule Unpublish content" and click "Next".
* Fill out the "Identifier" field with something like "node [node:nid]".
* Here comes the tricky part: fill out "Scheduled evaluation date" with something like "[node:field_unpublish_date-datetime]" where "field_unpublish_date" is the identifier of your date CCK field.
* You can lookup the available replacement tokens from the fieldset "Replacement patterns for saved content" above. Click "Save".

In my logs you'll also see that I followed the tutorials for affecting updated content as well.

Can someone help me with what needs to be changed in the steps above to get this working?

I think it would be great to extend the tutorials to include information about setting up the publish and unpublish dates together without causing the rules to interfere with one another.

Thanks again for a great module!

Comments

areikiera’s picture

Title: Need guidance on unpublishing (with cck date field) in combination with publishing with another cck date field » How to unpublish with cck date field after publishing with another cck date field

That last question was needlessly long...

How do you schedule unpublishing on the date/time entered in the CCK datetime field? Right now, it seems to conflict if I also have a publish action.

Thanks!

areikiera’s picture

Would really appreciate some guidance on this. Thanks!

lpolnitz’s picture

Title: How to unpublish with cck date field after publishing with another cck date field » how do you publish a content type based on a rule with a cck date field that won't keep the time?

I have all of my rules set up and triggers. a content type is created but date field to be entered does not keep the time you put in it. Help!

TR’s picture

Status: Active » Closed (outdated)
Issue tags: -unpublish, -rules, -publish