PDA

View Full Version : Re-occurring Calendar Events


Mutt
01-17-2002, 10:00 PM
Here's something quick and easy. I haven't been contributing lately but this was so easy and so cool, I figured I better share.

I wanted to be able to enter calendar events once which happen every year like Christmas and have them show up year after year.


edit template - calendar_enterevent

find
<option value="2004" $year2004selected>2004</option>

right after it add
<option value="0000" $year0000selected>every year</option>



edit calendar.php

find in (action==display)
WHERE eventdate
LIKE '$year-$doublemonth-%' AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");


and replace it with
WHERE (eventdate LIKE '$year-$doublemonth-%' OR eventdate LIKE '0000-$doublemonth-%') AND ((userid = '$bbuserinfo[userid]' AND public = 0) OR (public = 1))");



find in (action==update)
if (!checkdate($month,$day,$year))

replace it with
if ($year=="0000") {
$testyear= date("Y");
} else {
$testyear=$year;
}
if (!checkdate($month,$day,$testyear))



jump to ($action == "getday")
under
$eventdate = explode("-",$info[eventdate]);

add
if ($eventdate[0]=="0000") {
$eventdate[0]=$year;
}


thats it. Now enter a calendar event and when you pick the year, choose the new option 'every year'. the event will show up this year, next year, the year after. hell it will even show up last year. :)

I just did it and haven't tested it really well, but it sure looks like it works. let me know what ya think

Shenlong
01-18-2002, 06:14 PM
yay first to try this out, 1 sec i am just uploading files

Shenlong
01-18-2002, 06:22 PM
works like a charm! thanx so much! Now I can add all the yearly events and not have to readd them!

Mutt
01-18-2002, 06:43 PM
here's another calendar addition

it automatically changes the day select options when you change the month or year so that days like Feb 31 aren't available choices

https://vborg.vbsupport.ru/showthread.php?s=&threadid=34242

Shenlong
01-18-2002, 06:49 PM
Well I went there but the instructions for the 2nd part weren't clear, so I just left a message, go and check it plz

Lionel
01-21-2002, 04:30 AM
when you select the every year option, it does not display the event on front page at all!

Mutt
01-23-2002, 01:21 AM
It would be a the same update for the homepage as in calendar.php. I'll have to look at it and tell you exactly what to change.

I have a request. does anybody have a db of holidays? since we can have re-occurring events, I thought it would be nice to add the holidays to the calendar but I don't want to type them all in. if someone has a txt file listing holidays and dates (maybe even holiday descriptions) I'll make a little improt script and post it with the db.

I've been looking and just not findding anything.

thanks

Lionel
01-23-2002, 01:28 AM
My holidays are non Americans. :(

I still have it installed but cannot use it as the db does not seem to see "every year" and therefore not displaying event in front page (from hack to display event same like birthday). Once I reverted from recurring to 2002 it showed.

KevinG
01-23-2002, 02:08 PM
Great post but I already did something similiar for annual events. I used the year 1900 instead :) Year 0000 gave me problems.

I just never got around to posting it here. Too busy setting up the site.


Originally posted by Lionel
My holidays are non Americans. :(

I still have it installed but cannot use it as the db does not seem to see "every year" and therefore not displaying event in front page (from hack to display event same like birthday). Once I reverted from recurring to 2002 it showed.

I think I know which hack you are referring to.

This is a section from that original hack.

Find:

$today = vbdate("Y-m-d",time());

$events=$DB_site->query("SELECT eventid, subject, eventdate, public FROM calendar_events WHERE eventdate='$today' AND ((userid = '$bbuserinfo[userid]') OR (public = 1))");


Replace with:

$todayactual = vbdate("Y-m-d",time());
$today = vbdate("m-d",time());

$events=$DB_site->query("SELECT eventid, subject, eventdate, public FROM calendar_events WHERE ((eventdate LIKE '1900-$today') OR (eventdate = '$todayactual')) AND ((userid = '$bbuserinfo[userid]') OR (public = 1))") ;


and in another original section of that hack
Find:

while ($event=$DB_site->fetch_array($events)) {
$eventsubject = htmlspecialchars($event[subject]);


Replace with:

while ($event=$DB_site->fetch_array($events)) {
$annualevent = '';
if (substr($event[eventdate],0,4) == '1900') {
$annualevent = '*';
}
$eventsubject = $annualevent . htmlspecialchars($event[subject]);


This just precedes the event subject with an '*'.

Note again that I used 1900 instead of the mentioned 0000. A year of 0000 gave me troubles.

Mutt
01-24-2002, 05:43 PM
I like the little asterix addon and thanks for the help with the forum homepage hack.

looks like I missed a spots. probably should have posted this in the beta forum. anyway, here's a little more so they show up on all pages.

I added it to the original post

Now re-occuring events will show un on the getday page

Lionel
01-25-2002, 03:37 AM
Originally posted by Mutt

Now re-occuring events will show un on the getday page

No it does not. Like today 1/25 I have an event on homepage. I selected every year after applying the fix, it stopped showing. Do you have 0000 defines as every year somewhere?

I did like Kevin suggested and yours too (the two posts above this one). I am a little confuse with the 1900 from Kevin and 0000 in yours.

Anyway, I can't get an every year event to show. Any suggestions because this a great time saver hack?

KevinG
01-25-2002, 03:51 PM
Sorry Lionel,

I think I confused some here with what I posted. I actually made my own hack to get events and birthdays to display on a non-vb page (homepage). It is a hack of a hack. The original hack was for the displaying of news (pluhnews I believe. Can't remember but thank you to the hacker for this) on a non-vb page.

Using that hack, I made my own for displaying four more things on my homepage;


Today's Birthdays
Upcoming Birthdays
Today's Events
Upcoming Events


In my version of the hack, I use 1900 as the year for storing recurring events. I had problems saving years that were 0000. That is the only difference with mine. Any year should work as long as you are consistant in all areas that are looking for recurring events.

If you can post what you have for displaying your events on a non-vb page, I can try to help you sort out the problem.

Kevin

Lionel
01-25-2002, 03:59 PM
I am actually using the todaysevents.php hack to display on a vb page, under birthdaybits. I then installed re-occuring events. Problem is when I select that option, it is no longer displaying todays events on forumhome as, I assume, it gets confused with the year. It shows in calendar but not in index page.

KevinG
01-25-2002, 04:32 PM
Lionel,

Can you upload that file here?
I can look it over to see what the problem is.

Thanks,
Kevin

Lionel
01-25-2002, 04:37 PM
Thanks! PM me your email. They don't like for us to display vb codes on forums. I'll send you a zip.

Mutt
01-28-2002, 12:45 AM
this DOES work!
everything in the calendar script has been attended to so that re-occuring events will show up every year.

Lionel
you are talking about a seperate hack which displays calendar events on the main forum page. that will have to be modified just like the caledar script was modifed. I don't have that hack installed so I don't know exactly what will be change. I can tell you that it will be very similar to these changes that I've posted. if you would post the code that gets the events for your main forum page, I could tell you how to modify it.

Mutt
01-28-2002, 12:57 AM
New Year's Day: January 1
Groundhog Day: February 2
Mardi Gras: Tuesday, February 12
Ash Wednesday: Wednesday, February 13
Valentine's Day: February 14
President's Day: Monday, February 18
St. Patrick's Day: March 17
Passover (Begins at Sundown*): March 27
Easter: Sunday, March 31
April Fool's Day: April 1
Earth Day: April 22
Cinco de Mayo: May 5
National Teacher's Day: May 7
Mother's Day: Sunday, May 12
Memorial Day: Monday, May 27
Flag Day: June 14
Father's Day: Sunday, June 16
Gay Pride Day: Sunday, June 30
US Independence Day: July 4
Labor Day: Monday, September 2
Rosh Hashanah (Begins at Sundown*): September 6
Grandparents Day: September 8
Yom Kippur (Begins at Sundown*): September 15
Columbus Day: October 14
Boss' Day: October 16
Halloween: October 31
US Election Day: Tuesday, November 5
Veterans Day: November 11
Thanksgiving Day (US): Thursday, November 28
Chanukah (Begins at Sundown*): November 29
Christmas Day: December 25
Kwanzaa: December 26


doesn't seem like much and several are different every year because of the day of te week. Got em here
http://www.holidays.net/dates.htm

SirSteve
02-21-2002, 03:48 AM
I need something like this but instead of every year, how about x amount of days? Like a convention is May 1-7. Currently you would have to enter each day....

Tungsten
04-25-2002, 04:40 PM
Hmmmm. How would one tweak the code for this hack so that recurring events could be set for specific days of the week with a starting and ending date?

Example: every Tuesday from April 2nd, 2002 through March 30, 2003 I want the same event to be listed on the calendar.

Thoughts?

Mutt
04-25-2002, 09:23 PM
:)
funny, I wanted both of these options. My calendar is so hacked at this point, I stopped playing with it before it got too different from the original

not sure how to handle either, but I'll put some thought into it again.

re-occuring day of week with date range
ex 1 - every monday may to aug
ex 2 - second thurs of the month, every month

one event span multiple days

venomx
04-27-2002, 04:47 PM
I cant get this to work. :(

venomx
04-27-2002, 04:56 PM
I had to use the year 1900. mysql had added the date 2000 instead of 0000 when I looked at the tables.

mvigod
05-01-2002, 01:25 AM
date spanning of an event would be cool..either single event with span or recurring...bummer if you have to add a 7 day event and do one at a time!

mikesatx
05-17-2002, 10:07 PM
I am willing to pay anyone who can come up with this hack! Just let me know your fee. The sooner the better! I need a reoccurring event option for events spanning several days and events that occur once a week, month or year. An ingenious example of this done in cgi script is at http://www.perlcal.com/calenda2.htm. Logon as biff, password: demo. Hit the update button and add a new event. The calendar is not pretty but the reoccurring event function is a good idea. Please contact me as soon as possible if you have developed a hack for vbulletin and want a donation for your efforts.

mike-anderson@houston.rr.com

mikesatx
05-17-2002, 10:21 PM
I hear vb3 will have this option. Is this true? When is vb3 scheduled to be released?

Esdee
11-22-2002, 10:10 PM
great hack. :D
But I'm also looking for that hack Lionel was speaking of and can it be combined with this one ?

T&H
01-20-2003, 08:05 AM
Although this hack appears to be for re-curring annual events, is there a hack for adding an autodate feature so that a re-curring event can be inserted into the calender on numerous dates and months throughout the year?

A hack would be greatly appreciated.

T&H

Mutt
01-20-2003, 09:34 PM
T&H - I'm not really sure what you are looking for.

Wow, I did this so long ago. I was looking at vb3 and it looks like it has alot of similar calendar hacks to mine. At this point, you should just wait for vb3. shouldn't it be out soon.

I currently have multiple day events, anniversaries (re-occurring annual events), & event categories. You can also link a thread to an event, by adding it's threadid. You can display the calendar in monthly calendar view or event view which just lists the events with full descriptions.

I never added re-occurring monthly events, but I'll do it this time.

When I upgrade to vb3, anything that isn't in the new calendar, I'll write up a new hack. I've been slacking off on posting hacks because I'm too far from the original code by now and it gets confusing to write instructions. vb3 will give me a new starting point. :)

gopherhockey
01-30-2003, 08:16 PM
I too need more calendar functionality.. and I don't think we can wait for vb3 to come out (my guess is they won't have a public beta for many months, if even this half of the year based on how things have gone thus far)

We need recurring capabilities. Every month, every week, perhaps even every other week.

It would be cool if someone could get recurring to meet just about any need. Shouldn't it be a matter of math?

What we're trying to do is set up racing events, meetings etc. all that have various recurring themes.

ryancooper
04-03-2003, 03:55 PM
I can't find <option value="2004" $year2004selected>2004</option> in my calendar_enterevent
I am runing 2.3.0

Any ideas. . .

Zannie
08-07-2003, 03:13 PM
Is there a way I can modify this to allow for recurring weekly and daily events? :)

gmarik
09-20-2003, 04:20 PM
Could somebody just make a .txt file with a working version for 2.3 or maybe even 3.0? Thanks

TheComputerGuy
11-22-2003, 10:46 AM
I am checking into this now gmairk

gmarik
11-22-2003, 12:56 PM
It would be great to make a predefined list of dates of birthdays of my friends, so that vB takes one photo from my, for example, PhotoPost picture DB and sends it as an e-card, so, if I forget to congratulate them, atleast a few lines would be sent.

JustAskJulie
03-30-2004, 01:59 AM
Does this hack allow for weekly or monthly repeat events? or is there another hack available?