vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 2.x Full Releases (https://vborg.vbsupport.ru/forumdisplay.php?f=4)
-   -   Re-occurring Calendar Events (https://vborg.vbsupport.ru/showthread.php?t=34240)

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)
PHP Code:

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

and replace it with
PHP Code:

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


find in (action==update)
PHP Code:

if (!checkdate($month,$day,$year)) 

replace it with
PHP Code:

if ($year=="0000") {
$testyeardate("Y");
} else {
$testyear=$year;
}
if (!
checkdate($month,$day,$testyear)) 


jump to ($action == "getday")
under
PHP Code:

$eventdate explode("-",$info[eventdate]); 

add
PHP Code:

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/showthrea...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.


Quote:

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:
PHP Code:

$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:
PHP Code:

$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:
PHP Code:

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

Replace with:
PHP Code:

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


All times are GMT. The time now is 08:50 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01209 seconds
  • Memory Usage 1,764KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (10)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete