PDA

View Full Version : Display Grouped Events more sensibly when grouped by event


tgmorris
02-12-2005, 10:00 PM
Out of the box vBulletin displays events that are Grouped by Event by their eventid. Seems kind of dumb as they should be grouped by the starting date or some more logical criteria. This simple change does just that. BTW - I did a search and didn't see this posted so if I missed it mea culpa.

NOTE: This change impacts only the FORUMHOME display. If you are running the Upcoming Events modification for vBa CMPS you can make these same change to the minicalendar.php module.

In index.php find
// ### TODAY'S EVENTS #################################################

if ($vboptions['showevents'])Replace with
// ### TODAY'S EVENTS #################################################

function compare_dates($a, $b) {
// only used when sorting events grouped by event id
if ($a[0] > $b[0])
return 1;
if ($a[0] < $b[0])
return -1;
return 0;
}

if ($vboptions['showevents'])

A bit further down find
ksort($events, SORT_NUMERIC);Replace with
if ($vboptions['showeventtype'])
ksort($events, SORT_NUMERIC);
else
uasort($events, 'compare_dates');
That's it! Almost too simple.

nexialys
02-13-2005, 06:38 PM
good hack.. !

rlamego
02-14-2005, 12:07 AM
Thanks! =)

interfx
02-18-2005, 09:45 PM
Did this, but doesn't appear to be working... I'm using VBadvanced.com...

Any one have this issue?

tgmorris
02-18-2005, 09:53 PM
Did this, but doesn't appear to be working... I'm using VBadvanced.com...

Any one have this issue?
I've used this in both my vBa CMPS page and in my forums w/o any problems.

What makes you think it's not working?

T3MEDIA
02-18-2005, 09:59 PM
stupid as it may sound... what exactly is this doing?

tgmorris
02-18-2005, 10:28 PM
The default behavior when displaying events "Grouped by Event" is to display them based on their eventid - which bears no relation to when the event occurs. Thus events that happen way in the future may be displayed first if they were entered into the calendar some time ago. An event that occurs "tomorrow" may appear last simply becasue it was entered last - even though it should, more sensibly, appear first in the list.

This causes the events to be display based on their start date.

interfx
02-18-2005, 10:50 PM
I just double checked my modifications, and ti doesn't seem to work...

It is still showing my the order I entered them, not by the actual date...

Here's my attachment... Am I missing something stupid?

tgmorris
02-19-2005, 12:46 AM
Ah... You had me chasing a wild goose on this one. To have an impact on the vBa CMPS Upcoming Events stuff you need to edit the minicalendar.php module! It's the same code changes so it's pretty easy. The change I posted here impacts the FORUMHOME page only.

Whew!

interfx
02-19-2005, 12:53 AM
That did it...

Thanks for helping me out... You should add a quick note in your description above for those users using VBAdvanced...

Thanks again -
INterFX

Chriss74
03-05-2005, 05:46 PM
Thanks! Simple, but effective hack.

Greetings,
Chriss

YLP1
03-30-2005, 03:59 PM
I just reread the instructions and seen the index page....sorry for this post.

YLP1
03-30-2005, 04:05 PM
I placed this code in my index page but I am getting this error.

I am running version 3.0.7. What did I do wrong?


Parse error: parse error, unexpected T_ELSE in lpsforum\index.php on line 285

tgmorris
03-30-2005, 04:17 PM
I placed this code in my index page but I am getting this error.

I am running version 3.0.7. What did I do wrong?This should work fine with 3.0.7. What editor did you use to modify index.php?

YLP1
04-01-2005, 05:52 PM
This should work fine with 3.0.7. What editor did you use to modify index.php?
Notepad.

tgmorris
04-01-2005, 06:14 PM
Notepad.Did you cut/paste the new code or type it in? If you typed it in I'd guess you missed a ';' along the way.

YLP1
04-03-2005, 05:33 AM
I cut and pasted...... I have a new problem as well...... I have over 30 events for the Month of April and yet it displays a message that there are no events in the next 30 days....the calendar shows all the events FYI...

Any idea on what I did wrong here?

tgmorris
04-03-2005, 06:33 AM
I cut and pasted...... I have a new problem as well...... I have over 30 events for the Month of April and yet it displays a message that there are no events in the next 30 days....the calendar shows all the events FYI...

Any idea on what I did wrong here?What value to do you have in ACP -> vBulletin Options -> Forums Home Page Options -> Display Calendar Events?

Do you have any other changes to your vB index.php file? While there have been some changes in the TODAY'S EVENTS section they wouldn't imapct the way this hack works. If it's still not working feel free to PM me just the modified section of code from ## TODAY'S EVENTS ## to ## LOGGED IN USERS ## and I'll take a look to see what I can spot.

YLP1
04-03-2005, 07:10 PM
What value to do you have in ACP -> vBulletin Options -> Forums Home Page Options -> Display Calendar Events?

Do you have any other changes to your vB index.php file? While there have been some changes in the TODAY'S EVENTS section they wouldn't imapct the way this hack works. If it's still not working feel free to PM me just the modified section of code from ## TODAY'S EVENTS ## to ## LOGGED IN USERS ## and I'll take a look to see what I can spot.


acp has:
30 days for Display Calendar Events
10 Comments per page
Display Holidays: Yes
Upcoming Event Type is group by date

Am I allowed to post the code here (between Today's Events and Logged In Users)?

YLP1
04-05-2005, 10:48 PM
Hi TG..... I removed the mod and then redid it......and now it's working....I musta had a blond day that day....thanks for your help, I really appreciate it.

Kohhal
04-20-2005, 01:34 PM
Nice mod, definetly something that needs to be integrated into the software.

Simple install :squareeyed:

Devii
05-01-2005, 03:48 AM
Thanks for the fix :)

oldengine
05-14-2005, 10:22 AM
Clicks install. Excellent!

Viks
05-23-2005, 02:50 AM
INSTALLED!

nice modification.

Question:
Is there a way to display location next to event date on firumshome?

texasasl
12-20-2005, 06:51 AM
I was wondering whether or not could be worked in 3.5.2 I tried everything but seems does not work there.
I am attaching the modified .php, for your ease reference.
Is there any idea how could be done ???

tgmorris
12-20-2005, 02:22 PM
This should work fine for 3.5.2 so long as if ($vboptions['showeventtype'])is changed to if ($vbulletin->options['showeventtype'])At least it does on my forum.

texasasl
12-20-2005, 06:51 PM
This should work fine for 3.5.2 so long as if ($vboptions['showeventtype'])is changed to if ($vbulletin->options['showeventtype'])At least it does on my forum.


As you can observe from the attached file I have did that already, but still does not function properly. Can you please have a look on that attachment it is according your suggestion. Also the file is "forum.php".

tgmorris
12-20-2005, 07:41 PM
As you can observe from the attached file I have did that already, but still does not function properly. Can you please have a look on that attachment it is according your suggestion. Also the file is "forum.php".

Do you have a link to a page where I can the problem?

texasasl
12-21-2005, 12:13 AM
Do you have a link to a page where I can the problem?
Of course it is www.phoenix-radio.gr and then ΠΡΟΓΡΑΜΜΑ, or http://www.phoenix-radio.gr/calendar.php (just sign-up first). Appreciate your interest and your assistance.

Itworx4me
12-27-2005, 03:46 AM
Ok I have tried your 3.5.2 modification and I am having the same results as the person above. Any ideas to the fix???

Thanks,
Itworx4me

tgmorris
12-27-2005, 04:18 AM
Of course it is www.phoenix-radio.gr and then ΠΡΟΓΡΑΜΜΑ, or http://www.phoenix-radio.gr/calendar.php (just sign-up first). Appreciate your interest and your assistance.texasasl - It seems there's a typo in the code you provided that would be causing the problem.
if (!$vbulletin->options['showeventtype'])
ksort($events, SORT_NUMERIC);
else
uasort($events, 'compare_dates');
If you remove the '!' things should work right.

Itworx4me - If you're having the same problem please check your code for a similar error.