By andrewfn on
I know about the schedule module, but that requires extra information to be entered on every node. Event nodes already have dates. It would seem a very common requirement to have events disappear once they are past. Does anyone know of a way to accomplish this?
Comments
I'm pretty sure that
I'm pretty sure that http://drupal.org/project/scheduler will do what you want.
www.aussiecarpool.com
share the cost of commuting
www.justapickle.com
blogging community for the socially conscious
www.slickfish.com.au
professional, affordable web site design, production and maintenance for small business
Unpublish from where? From
Unpublish from where? From the page? They disappear automatically from the Upcoming events block once the time is past.
unpublish from: taxonomy related pages
Several of my sites have a lot of events. The way I structure the sites is to tag all the events with a taxonomy name and then all events of that type can be viewed from associated the taxonomy page, which I link to a menu item. Everything works very well, except that old events have to be manually unpublished or they still keep appearing.
Solved the problem
I have solved the problem by writing the following ultra-simple module called eventhide. If an event is more than a day old, then it's 'changed' date is set to 1999-12-31. I have replaced the standard taxonomy view using the views module to exclude nodes that have changed dates before 2000-01-01 and to put the items in ascending order. Stickies will still show at the top. The advantage of this approach is that if an event gets modified so that it is in the future again (e.g. by recycling old events), then the 'changed' date will automatically be updated and the event will be unhidden.
The code shows an alternative line of code which will unpublish events, but then of course they will disappear from the calendar.
I would value any comments on the code:
Well, I tried this, but now
Well, I tried this, but now all my dates are out of my calender...
Only odd saterdays and odd sundays show up now, and dates with events.
I removed your module and everything is still blanc in IE6. In Firefox, all dates are being displayed again normally. Don't know if this is an IE problem, cache problem, or problem with your code.
IE problem / cache
The only thing my code will modify is the "changed" date on each node. It runs a check and makes changes every time cron is run. If you remove the module, it won't put the old values back again since the change is made in the database.
Unless you set up a view that makes use of this new changed date, then you will see absolutely no difference on your site. The fact that dates are being displayed in Firefox means that your pages are being generated correctly by Drupal. I strongly suggest that you turn off caching while developing the site otherwise you *will* get strange effects. Also it is a good idea to close and restart IE to force it to refresh.
thank you
this seems to working well for me,
I have chosen to leave the nodes published for the sake of non-broken (and recycling ;)) URL's and I have also set up an admin "view" to show which nodes I can then recycle more easily ~ I left the comment count showing so I don't recycle events which perhaps had comments
I don't know if this is the best way but I like it, thank you for your ideas and code!
event_cron method
I added this method to event module, to remove the stickies (on top of page) and promote (on frontpage) of the event:
That was enough for me. I didn't want to delete the old events.
Might help some.
Marc
Yes, this worked for me,
Yes, this worked for me, too.
I changed the code a bit to unpublish expired events, by changing the 'sticky' variable to 'status'.
Thank you for this code,
Thank you for this code, worked great with Drupal 5.x
Great
I will try these codes they are exactly what I want.
Richard Ma
www.meetcampus.com
sorry i'm a beginner here ...
sorry i'm a beginner here ... i don't know how to do that : i simply open the event.module file in notepad, paste in the end the code you wrote, save and upload to the site ?
I did that, but then what ? Where to administer if we want them sticky or not, published or not ?
Thanks a lot in advance for your help with this.
Hi Marc
where i have to paste that coding?? In Calendar or Date module?? please tell briefly
fixed that code for drupal 6
This code is great - I just had to fix two lines for drupal 6:
For some reason original lines did not work.
andrewfn, I realize this
andrewfn,
I realize this thread is rather old, but I have a question if you are still around to help.
You said,
using the views module to exclude nodes that have changed dates before 2000-01-01
I am new to Drupal and am still trying to figure out how the filtering and rules works. I have Events module and the Views module installed on a 5.12 installation. I am using a View for events that are linked to my calendar, and a Block through the same View. This Block I display on the right sidebar of my site where Teasers of upcoming events are displayed.
Of course if I do not add any new content to this Block, expired events remain on the right side bar for all to see..
So I am at the Edit page for this View I have, and I do not know how to set it to exclude nodes that have changed dates before 2000-01-01. I figured out how to put them in ascending order, but I need help with the exclusion based on date method!
Can someone please shed some light my way! Thanks!
Mike
http://drupal.org/project/sch
http://drupal.org/project/scheduler is what u need
saitanay, Thank you for your
saitanay,
Thank you for your reply, however this will unpublish nodes which I do not need. I ended up just removing the block from my front page.
I found out that in D6 there is a module to add different types of publishing options that could then be used with a Views filter, so I think I'll go this route as soon as I make the jump (yeah, I'm still using D5...)
Thanks,
Mike