By avior on
Hello
I have wrote a small module to automating and manage past events
the admin can choose to delete / unsticky / unpromote / unpublish an event that past (cron hook)
is there another (a better way) doing this ?
anyway (even for academic reasons) I'll be happy to understand what is the correct way to do the query of the past events, this is my code :
$curtime = time();
$closing_time = $curtime - variable_get('date_default_timezone', 0);
$result = db_query("SELECT e.nid FROM {event} e inner join {node} n on e.nid = n.nid where n.status =1 AND e.event_end < %d", $closing_time);
my guess that it's not that simple , parameters i had in mind are :
1. the machine time & timezone
2. site timezone
3. the event timezone
how to i add the machine timezone ?, what about the event time zone ?
Thanks Avior
Comments
get it to work?
did you ever get this to work?
anyone know of another module / snippet that does this?
No One answered
Hi
I thought there are others ways doing this, this is the reason no one answered.
I have wrote the module but it has time shift (because of the things i have wrote).
The shift is forward (the hoster time zone if after my time zone) so the event is deleted after half a day, so it's fine for me
I did not want to upload the module to drupal site until I fix those things, so I am waiting...
If you can help solving this, I will upload the module
Anyway the module is very small , the code i have pasted is the main logic, now you can set the promote, publish, sticky to 0, or just delete the event depend on your goals.
Avior
Dev Art- Drupal Based Services and development
Interested in progress...
of your module. Found the views scheduler module but don't know if that's overkill for unpublishing events are they happen. Hmmm, how does the event module's upcoming event block unpublish events?
Just realized you can find the answer to unpublishing events here:
http://drupal.org/node/77166
Thanks.
my module is just the same
Hi
Thanks for the interest in this module
My module is the same but have all options by settings page : unpublish [or/and] unpromote [or/and] unsticky or delete the event
look at previous issue of mine http://drupal.org/node/143037.
there are few ways doing this
you can do it with http://drupal.org/project/scheduler , or http://drupal.org/project/sched_act
or http://drupal.org/project/actions
As i can see in the code of scheduler it deals with the timezone ,i didn't know how to handle.
if you want i can upload my code somewhere for you to download, i find my code good for my purposes, you will have to be carfull about the timezone issue
Avior
Dev Art- Drupal Based Services and development
interested in your module
hi im interested in your module as it sounds just like what i want.
does it delete the event 1/2 a day after the end date of the event?
if it does then i'd like to copy it off you and use it myself if you let me?
but i have never added a new module to the site now know how to so if you have a page that will tell me how or if you can yourself that would be greatly appretiated.
kind regards
chris
here is it
Hi
I am sure that there are better ways doing that now, but here is it
This is drupal 5 module that use the event module (it looks for table named "event")
please check this module carefully cause i am not using it anymore in the last year or so
http://dev-art.net/files/past_events.tar
good luck
*_*
For machine time zone, you can use date() function.
For event time zone, you should what user has added it and what's the time zone user has set for oneself. You can get this by loading user in an object.
After that, you should convert the event time to the time you want.
Hope this can help you.
Regards.
Regards.
🪷 Beautifulmind