I was trying to figure out a way of unpublishing nodes after the date has expired. I've tried Node Expire and Scheduler modules but they both add another step to the process. It would be nice to have the nodes automatically expire after their associated date has passed but I can't figure out a way to do it... anybody have this problem?

Comments

cgjohnson’s picture

I'm wondering this same thing. would be great. ANyone have info?

gpk’s picture

>both add another step to the process
I've used Scheduler (admittedly for publishing nodes rather than unpublishing them) but not had any problems ... I don't understand what the problem is with it. Can you elaborate?

fletch11’s picture

From what I've seen with Scheduler you have to enter an unpublish date as a separate feed. I would like to have the Scheduler function automatically associated with the To Date so the node is unpublished after an event has passed. Not sure if there is a way to prepopulate the Scheduler field with the To Date or some other way to get this effect?

Thanks.

jpp’s picture

Perhaps the way to do this is to use a view to limit display of notes in the past and then on a semi regular basis use views bulk operations to unpublish or delete everything that's long gone. That's what we're doing for http://sf.carnalnation.com/events/results (also using faceted search, very cool module)

fletch11’s picture

Thanks... your site looks good. I am also using faceted search and I love that module. the problem is I have more than one content type, some with dates and some without so I cannot selectively filter just events from a view with multiple content types. Might just have to periodically flush out old events until I can figure out a fix.

dpatte’s picture

I have a similar issue.

I have a series of nodes that have a CCK repeating dates field. I would like to unpublish the nodes when the last of the repeating dates has passed - ie: the item has expired.

I was thinking of using a view to select these expired records, then using rules executor:
- unpublish the node
- send an email to the author indicating that the node has expired

Its easy enough to find each node where any (or the first) of its repeating dates has expired,
but I just cant see how to find a node when its repeating date field has no more repeats (or its last repeating date field is expired).

Any ideas?

Thanks

dpatte’s picture

Any furhter ideas on this? I would like to select expired nodes (nodes with no upcoming dates), then using rules or something similiar unpublish those nodes.

I just cant figure out how to use views to find each expired node. See above

dpatte’s picture

I have been working on a solution to this and I'm 90% there.

What I have done is use rules-views integration (with rules executor) to set flags on the nodes with dates.

1) Step one goes through all the nodes and sets an EXP flag on each node that has a date
2) Step two goes through all the nodes and unsets the EXP flag if it has any recurring event date in the future
(this leaves the flag on, but only for fully expired nodes!)
3) Step 3 goes through all the nodes that still have an EXP flag (the fully expired nodes) and unpublishes them, and sends an email to the author.

At this point, each step runs well manually. so the process should work,
but what has me stumped is how to run these 3 steps sequentially and automatically once per day.

I'll post when I have the solution complete.

tyler-durden’s picture

dpatte,
I have been pulling my hair out for hours trying to find a solution to this, any luck? I am importing auctions from other sites as nodes into Drupal, and the only real field I can pass the expired date/time data is to the CCK Date field.

dpatte’s picture

Tyler, As mentioned in #8 I have a working, albeit 'semi-manual' solution. Once per week, I run step 1, then when its finished, I run step 2, then when its finished, step 3.

I haven't found a way to run the three steps automatically, but it perhaps would be possible to have the first step run automatically daily, and within that ruleset schedule step 2 to run 5 minutes later. Then have step 2 schedule step 3 to run 5 minutes later than that. For me the weekly 'semi-automatic' run is painless, so I'm still using it.

tyler-durden’s picture

Thanks for the details dpatte,
Unfortunately I don't think that will work in my case. I will be temporarily having the nodes expire after a certain time using the Feeds module, this will get me by for awhile until I resolve this at a later date. Thanks for the input.

skizzo’s picture

First I add a ruleset named
"Unpublish node {rule set}" which includes a single rule
"Unpublish node action {rule}" which includes a single action
"Unpublish Content {argument}" which takes "Content" as argument

Now, let's say I am creating a node with a CCK date field named "field_symposium_date".
I can add a triggered rule "Schedule Unpublish Symposium" (triggered after saving new content)
The triggered rule says: if content type is Symposium then do action...
I pick the action 'Schedule "Unpublish node {rule set}" ' (from the Rule Scheduler group)

The action configuration includes three items:
- Argument: I select "created content" (will be passed as an argument when time comes)
- Identifier: I enter "Unpublish Symposium node/[node:nid]" (will end up in the scheduled tasks queue)
- Scheduled evaluation date: this takes PHP Evaluation and tokens

I can have the Symposium unpublished automatically one day after the event by entering

<?php echo [node:field_symposium_date-timestamp] + 86400 * 1; ?>
gpk’s picture

Status: Active » Fixed

No replies for a while and #12 looks like a good solution.

Status: Fixed » Closed (fixed)

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