View Full Version : ported the upcoming events hack
KW802
10-01-2004, 12:43 PM
OK, I haven't had enough caffiene yet this morning or something....
I didn't make the change to functions.php and it appears to be working as expected. What is that change going to do? :confused:
Samir
10-03-2004, 02:07 PM
If you're running 3.0.3, no changes are needed in functions.php. Apparently the code change from 3.0.1/2 to 3.0.3 includes whatever this hack needs. "If if isn't broken, don't try to fix it." ;)
SomeName
10-05-2004, 01:31 AM
Does anyone have any suggestions as to how I could get this to pull events from a different calendar?
I have it working on my home page for one calendar, but I need to have another module pull events from a second calendar for a different page.
Hope that makes sense.
Samir
10-05-2004, 02:49 AM
I believe you can set the option for which calendar to pull event listings from when you edit or create a page.
SomeName
10-05-2004, 10:49 AM
The events still pull from the default calendar. I'll check again, though...
I'm not seeing anything related to that particular option. :(
Samir
10-05-2004, 11:23 AM
Actually, I remember someone else having the same issue. The problem is the upcoming events only pulls from the default calendar in vb itself. This is even the case with the built-in upcoming events on the forum home. I think I recall some people coming up with solutions on either here or vbulletin.org or both. I'd try some searches, but you'll probably have to wade through a lot of stuff before you find it. :(
SomeName
10-05-2004, 11:37 AM
LOL thanks for the ray of hope! I'll keep searching and you're right, there's a lot to wade through. I'm learning as I wade though. :D
Samir
10-05-2004, 11:44 AM
It's time well spent. 2 months ago I didn't know what the heck the template was and never even saw php code before. Now I'm planning to write 2 of my own calendar hacks. :D
SomeName
10-05-2004, 11:46 AM
hehehe, be sure to consider those using multiple calendars when your creating them. ;)
Hey, thanks for your input! :)
Kizzmet
10-07-2004, 03:26 PM
Have it installed, thank you very much!
memobug
10-07-2004, 11:27 PM
1. Don't forget to update the Templates Used group for the Minicalendar to also cache the new template:
adv_portal_calendar,
adv_calendar_todaysevents,
calendar_smallmonth_day, calendar_smallmonth_day_other, calendar_smallmonth_header, calendar_smallmonth_week
2. Someone should really update the installation instructions for 3.0.3 to omit the confusing and unnecessary last to change /includes/functions.php since that line of code doesn't exist.
Regards,
Matt
robert_2004
10-13-2004, 10:41 AM
I installed this mod, and have just got around to adding events to the calendar.
on the index.php page, it only shows one underline on a day - marking an event - but doesn't show the event in the 'upcoming events' (it says "No events scheduled in the next 45 days.").
i've added 5 events now, and it seems to be stuck on that first event, which is taking place 2 days from now, then the rest are a week away.
When i go to a page located in the forum/ directory, THEN the mini calendar works and displays the upcoming events properly.
Anyone have this problem, or can give me some sort of fix???
Samir
10-13-2004, 02:51 PM
All I could suggest is double check the code changes. It sounds like it's in there somethere. Something could be in the wrong place or missing.
attroll
10-16-2004, 11:02 PM
Right now as it stands if you opt to Show admin defined holidays on your calendar then it will show them in you events but it will not have a description just a date. Is there any way to have it so that is will have a description instead of just a empty date or just say something like Veterns Day.
Nautiqeman
12-01-2004, 02:17 AM
I'm having the same problem as some of the others.
I'm using vB 3.0.3 and CMPS v1.0.0
I have 2 events scheduled in Dec. and it's set to show the next 20 days, but no events showing.
What do you need to do to pull this info to show?
Samir
12-01-2004, 05:29 PM
I recently added some events on my test server and they didn't work either (didn't show on upcoming). Very strange. They work fine on my live server. I rebuild all sorts of indexes and tried a bunch of different things. I couldn't figure it out.
Nautiqeman
12-02-2004, 09:29 PM
Someone with 3.0.3 has to have figured the problem out and how to fix it
attroll
12-03-2004, 12:02 PM
I have this working fine in 3.03. Here is my step by stap instructions on how I installed it on my site.
Instructions for including the list of upcoming events under the mini calendar
for vbadvanced CMPS. This version works with vb3 Gold.
Step #1:
Find:
eval('$home[$mods[\'modid\']][\'content\'] .= "' . fetch_template('adv_portal_calendar') . '";');
Above that add:
// ### TODAY'S EVENTS #################################################
if ($vboptions['showevents'])
{
require_once('./includes/functions_calendar.php');
$future = gmdate('n-j-Y' , TIMENOW + 43200 + (86400 * ($vboptions['showevents'] - 1)));
$eventstore = unserialize($datastore['eventcache']);
if (!is_array($eventstore) OR $future != $eventstore['date'])
{
// Need to update!
require_once('./includes/functions_databuild.php');
$eventstore = build_events();
DEVDEBUG('Updated Events');
}
unset($eventstore['date']);
$events = array();
$eventcount = 0;
foreach ($eventstore AS $eventid => $eventinfo)
{
$offset = iif (!$eventinfo['utc'], $bbuserinfo['tzoffset'], $bbuserinfo['timezoneoffset']);
$eventinfo['dateline_from_user'] = $eventinfo['dateline_from'] + $offset * 3600;
$eventinfo['dateline_to_user'] = $eventinfo['dateline_to'] + $offset * 3600;
$gettime = TIMENOW - $vboptions['hourdiff'];
$iterations = 0;
if ($bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWCALENDAR OR $eventinfo['holidayid'])
{
if ($eventinfo['userid'] == $bbuserinfo['userid'] OR $bbuserinfo['calendarpermissions']["$eventinfo[calendarid]"] & CANVIEWOTHERSEVENT OR $eventinfo['holidayid'])
{
while ($iterations < $vboptions['showevents'])
{
$todaydate = getdate($gettime);
if (cache_event_info($eventinfo, $todaydate['mon'], $todaydate['mday'], $todaydate['year']))
{
if (!$vboptions['showeventtype'])
{
$events["$eventinfo[eventid]"][] = $gettime;
}
else
{
$events["$gettime"][] = $eventinfo['eventid'];
}
$eventcount++;
}
$iterations++;
$gettime += 86400;
}
}
}
}
if (!empty($events))
{
ksort($events, SORT_NUMERIC);
foreach($events AS $index => $value)
{
$pastevent = 0;
$pastcount = 0;
unset($eventdates, $comma, $daysevents);
if (!$vboptions['showeventtype'])
{ // Group by Event // $index = $eventid
foreach($value AS $key => $dateline)
{
if (!isset($comma))
{
$firstdate = $lastdate = $dateline;
}
else
{
$lastdate = $dateline;
}
$comma = ', ';
$eventinfo = $eventstore["$index"];
}
$eventdates = vbdate($vboptions['dateformat'], $firstdate, false, true, false);
if ($firstdate <> $lastdate)
{
$eventdates .= ' to ' . vbdate($vboptions['dateformat'], $lastdate, false, true, false);
}
if ($eventinfo['holidayid'])
{
$callink = "$vboptions[blockbullet] " . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&holidayid=$eventinfo[holidayid]\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
}
else
{
$callink = "$vboptions[blockbullet] " . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&e=$eventinfo[eventid]&c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
}
}
else
{ // Group by Date
$comma = "$vboptions[blockbullet] ";
$eventdate = vbdate($vboptions['dateformat'], $index, false, true, false);
foreach($value AS $key => $eventid)
{
$eventinfo = $eventstore["$eventid"];
if ($eventinfo['holidayid'])
{
$daysevents .= $comma . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&holidayid=$eventinfo[holidayid]\">" . $vbphrase['holiday_title_' . $eventinfo['varname']] . "</a>";
}
else
{
$daysevents .= $comma . "<a href=\"$vboptions[bburl]/calendar.php?$session[sessionurl]do=getinfo&e=$eventinfo[eventid]&c=$eventinfo[calendarid]\">$eventinfo[title]</a>";
}
$comma = "<br>$vboptions[blockbullet] ";
}
}
eval('$eventstoday .= "' . fetch_template('adv_calendar_todaysevents') . '";');
}
// memory saving
unset($events, $eventstore);
}
else
{
$eventstoday .= "<tr><td class=\"alt2\" colspan=\"7\" align=\"center\"><span class=\"smallfont\">No events scheduled in<br>the next $vboptions[showevents] days.</span></td></tr>";
}
}
Step #2:
create a new template called: adv_calendar_todaysevents
with the following in the template:
<tr><td class="alt2" colspan="7"><span class="smallfont"><if condition="!$vboptions['showeventtype']">
<strong>$eventdates</strong><br />$callink
<else />
<strong>$eventdate</strong><br />$daysevents
</if></span></td></tr>
Step #3:
Open the template: adv_portal_calendar
below this: $calendarbits
add this:
<if condition="$vboptions['showevents']">
<tr><td class="thead" style="font-size: 11px;" colspan="7" align="center">Upcoming Events</td></tr>
$eventstoday
</if>
Step #4:
In functions.php (forumroot/includes/functions.php
Find:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showcalendar']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
replace with:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index' AND $vboptions['showevents']) OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
Well that is how I did it. I hope this helps someone.
Nautiqeman
12-03-2004, 05:52 PM
Doing step 4 causes this:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ucwaterski/www/forums/includes/functions.php on line 1887
attroll
12-03-2004, 11:40 PM
Doing step 4 causes this:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ucwaterski/www/forums/includes/functions.php on line 1887
Sorry,
I went back and looked at my In functions.php file and found that I had something different. So try this in step #4 to replace what I had before (forumroot/includes/functions.php
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index') OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
Please let me know if this helped.
Nautiqeman
12-04-2004, 09:03 PM
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ucwaterski/www/forums/includes/functions.php on line 1887
In step 4, I don't have the code to replace, it's similar in the original vB 3.0.3 code, this is what it is:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
Nautiqeman
12-04-2004, 09:08 PM
If you go to my front page: http://ucwaterski.cheaphack.com
You will notice that the mini calendar doesn't show when there are evernts (with a link to that day)... if You go to the calendar and click on a scheduled event, it takes you to a default calendar. It's almost like the Upcoming Events list is pulling from the mini calendar (which doesnt show any events) and not from where the events get scheduled....
attroll
12-05-2004, 02:09 AM
Nautiqeman
I went to your web site. I even registered but it will not let me view the calendar. It says I do not have sufficient privileges to access this page. Maybe that is one of the reasons it does not work. Are your permissions set correctly?
When you installed CMPS as your frontpage there were directions that it looks like you missed if that is what you have for your code. It told you to do this:
Find:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
Replace with:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index') OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
Nautiqeman
12-05-2004, 10:49 AM
The permissions are set up so that unregistered and registered users are not able to view the calendar... Only the team members usergroup...
I believe when I tried to change that code when installing CMPS, it caused me to get an error. I'll try it right now and I'll put you in the team member usergroup so you can see the calendar.
Thanks for all of the help
Nautiqeman
12-05-2004, 10:57 AM
I don't have that exact code to find but when I find what is similar to that, I get this:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/ucwaterski/www/forums/includes/functions.php on line 1887
Nautiqeman
12-05-2004, 11:14 AM
ok I opened the original functions.php file that came with the forums when I downloaded 3.0.3 and found this line:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
but when i replaced it with the code you gave me:
if (THIS_SCRIPT == 'online' OR THIS_SCRIPT == 'calendar' OR (THIS_SCRIPT == 'adv_index') OR (THIS_SCRIPT == 'index' AND $vboptions['showevents']))
I still get the error on line 1887.. any idea why?
attroll
12-05-2004, 01:16 PM
Are you using Dreamweaver to do your editing?. Here is a link that might interest you that I found. It is the same error you are getting.
http://www.vbadvanced.com/forum/showthread.php?t=2770&highlight=Parse+error
http://www.vbadvanced.com/forum/showthread.php?t=1745&highlight=Parse+error
Nautiqeman
12-05-2004, 02:19 PM
Yes, I used Dreamweaver for an editor
Nautiqeman
12-05-2004, 02:25 PM
attroll
You are a good man sir. The fact you kept helping me shows the kind of gentleman you truly are. That fixed it, oddly enough. Again, I appreciate the help you gave me [beer]
indie
12-12-2004, 05:11 PM
This thread is confusing me, so what is the correct code for 3.0.3 and cmps?
Is the original download good? Or what to change?
thanks
Samir
12-13-2004, 11:41 PM
The original instructions should work for 3.0.3--that what I have on my live site at www.huntsvillecarscene.com. The only thing you don't do is change functions.php.
But even then you may have a problem like some of us have run across where events don't show. It works on my live server and not on my test setup. It's got me puzzled.
maniac
12-19-2004, 10:34 PM
Nevermind
I found out that I was altering template in a different style (what if one has 50 styles? dose he have to change each and every template?)
Install this mod (http://www.vbulletin.org/forum/showthread.php?t=72288&highlight=Copy+Custom+Templates), it's saved me an incredible amount of time...
KW802
12-19-2004, 10:53 PM
1. Don't forget to update the Templates Used group for the Minicalendar to also cache the new template:Would be good. I just realized this weekend that I had an uncached template when there were any events being listed. I was about to comment on it when I saw that you already came across it. :)
1996 328ti
12-25-2004, 04:57 PM
any word on birthdays ?
Did I overlook something?
Can birthdays be added to the events?
suryoyena
01-13-2005, 05:21 PM
i can't find the option to edit the days of upcoming events. where is it exactly in my acp ?
andy i have 3 events in one day. why are they shown like in attachment below ?
Tom M
01-13-2005, 05:36 PM
Check in the ACP under Forums Home Page Options.
You can set the number of days as well as whether to display grouped by event or by date.
suryoyena
01-14-2005, 12:46 AM
hmm, my VB is in german, and i don't know the exact translation for Forums Home Page Options.
It's the 12th from the bottom in the list.
Google says it's called "ForumcHome PAGECWahlen" =)
SalTheWop
01-19-2005, 07:51 PM
Where do I find this option in the ACP of 3.05? I cant find Forum Home Page Option anywhere. There is a Calendar Manager option ,but no mention of setting how many days ahead are displayed
Tom M
01-19-2005, 08:29 PM
It's under "Vbulletin Options".
alkatraz
01-26-2005, 05:33 PM
Thanks for this hack!!
Works great on Vb3.03.. (I didn't make the change to functions. )
I've always hated that mini calendar but wanted a dynamic event listing, so i went a step furthor and removed $calendarbits from the template "adv_portal_calendar".
http://northwestnissans.com
ONE PROBLEM,
my events aren't listing chronologicaly..??? (2 feb events, then a Jan, then another Feb!!)
Tom M
01-26-2005, 06:24 PM
ONE PROBLEM,
my events aren't listing chronologicaly..??? (2 feb events, then a Jan, then another Feb!!)This happens when you have the events set up to display grouped by event instead of by date. The sort order when events are displayed in event grouping is by the event id.
Look a few posts back on how to change that by using the ACP.
alkatraz
01-26-2005, 07:09 PM
you the man! worked perfectly thx
interfx
01-29-2005, 08:09 PM
I tried this hack, but new events do not show up... Here's what I did...
1. Modified modules/minicalendar.php
2. Created Templates & modfied
3. Did not change the includes/functions.php file (and then tried the mod also) - neither worked...
Here's what it looks like... (attachment)
As you can see the days show the new events (links on teh dates), but do not show up underneath... I am using VB3.0.6
Any ideas?
InterFX
What's the number of events you have in your Admincp -> vBulletin Options -> Forum Home Page Option -> Display Calendar Events?
I'm trying to hack the minicalendar.php to ignore the vB setting and display only a selected number of events (which I'll hard-code in this file) but I'm having a great difficulty to figure out the while's and the foreach's.
Any help will be appreciated =)
interfx
01-29-2005, 10:17 PM
Choose the number of upcoming days that you wish to display upcoming events from.
I have entered 10 (days)
Still not working...
Thanks for any ideas...
InterFX
Do you have more than 2 styles, and if yes, are you sure you edited both or the right one?
If you have upgraded vB or CMPS, have you redone all the template changes (my adv_portal_calendar was reset by CMPS 1.0.1)?
Did you edit your minicalendar.php properly? The instructions are poorly written for step 1.
Can't think of anything else...
DaveSki
01-30-2005, 04:14 AM
My Upcoming events block show each event twice. Is that an error, or a bug. Does anyone know what might be causing this.
interfx
01-30-2005, 09:22 AM
That fixed it... my adv_portal_calendar was reset somehow...
Thanks again...
INterFX
vBulletin® v3.7.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.