Version: 1.10, by ProFifaLeagues
Developer Last Online: Nov 2023
Category: vBulletin Forum Sideblocks -
Version: 4.0.0
Rating:
Released: 11-05-2010
Last Update: Never
Installs: 96
Re-useable Code Translations
No support by the author.
Upcoming Events in Forum Block/Sidebar
Add the "Upcoming Events" in the forum side block
(Added as a few people seem to have issues with other mods the same)
Start by logging into your Admin cp
Goto Forums and moderators - Forum Blocks Manager and add a new Block.
Call the Block Upcoming Events(Or what ever suits your liking)
Set the block to Active
And use PhP Format.
Now add the content below :
PHP Code:
ob_start();
// %d $show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from < '%d' AND dateline_to > '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
Then just make sure the template to use is set to Block_HTML
This will then show the latest upcoming event from your calendar with multi-day events shown until the last day of the event.
Update Thanks to dcuellar
What this does is add a picture centered above the upcoming event. The picture is uploaded to 'images/' as event.jpg. You can change that to whatever you want. It also corrects the issue I had with the date. It's now projecting the proper date.
NOTE:
I changed the number of events to display to 1.
I do not need the range on my forum so I did not test that part.
Here you go for those interested (change what's in Red):
PHP Code:
ob_start();
// %d $show_count = 1;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to > '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
Thanks go to cybaGirl for this fix:
Anyone who has the date showing as the day before can use this code in there forum block.
PHP Code:
ob_start();
// %d $show_count = 5;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from < '%d' AND dateline_to > '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
Second thing is there a way to make it pull dates from a single calendar? At the moment it also pulls from a private calendar
Change the code like this:
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND calendarid = X AND (dateline_from > '%d' || ( dateline_from > '%d' AND dateline_to > '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);
X should be the ID of the calendar you want the events to be taken from.
I am not a professional programmer, i. e. an expert should have a look at it.
I've updated this widget with the code that was suppose to fix the date issue (displays one day behind) but this code did not fix the date issue.
Suggestions?
Thanks!
I tried all above variations, and the dates were still sometimes off one day.
My solution: I took out dates entirely, and I took out the images as well. Now it is just one line per event, with a descriptive link to the calendar. It's nice and compact.
Even though it required some tweaking, this code is fantastic and exactly what I was looking for.
This "lite" version is what I applied, with slight modifications to reduce the text size, eliminate the images/missing image errors, and eliminate the misbehaving single date field.
I have only had my VB forum license for a week, but have learned so much from these forums that has helped me customize and configure it.
Thanks to all
PHP Code:
ob_start();
// %d $show_count = 4;
$query = sprintf("SELECT * FROM ".TABLE_PREFIX."event WHERE visible = 1 AND (dateline_from > '%d' || ( dateline_from < '%d' AND dateline_to > '%d' )) ORDER BY dateline_from ASC LIMIT %d",TIMENOW,TIMENOW,TIMENOW,$show_count);