Goto Admincp->vBullietin CMS->Widgets->Create New Widget
Choose PHP Direct Execution as Widget's Type
Place a Title. eg Upcoming Events. Keep it short as this is what will appear as title on your pages.
Click Save
Click Configure on the right of the new created widget.
Remove the default code that appears. Be sure to not leave behind even a single letter.
Copy and Paste the code that you can find below.
Leave the template name as is (vbcms_widget_execphp_page)
Click Save
Goto Admincp->vBullietin CMS->Layout Manager
Click Go on the Default Layout
Add the Widget to your Layout
Click Save
That's all !!
PHP Code
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);
I tested this Widget and one downside is that it displays threads even in hidden/private subforums.
Is there a way to disable showing of threads from such forums? For example, it displays bad posts reporting threads and user infraction threads (which shouldn't be the case).
I cannot for the life of me get it to display the event on the day it is occurring... I live in the US in the eastern time zone, have tried various offsets and nada...
It works for me, but I would like to be able to translate the words in the time format.
The widget is using english rather than my default and translated lang.. Am I overlooking somthing?
I tried this widget using the default code at Post #1. Setting an event say from 2 April 2010 to 4 April 2010; when 2 April comes (ie today) the whole event no longer appears.
I used the code you linked at #33 instead and now all my events are shown as one day late! Using back that example, if I set an event from 2 to 4 April, it now shows up as 3 to 5 April instead!
I tried just adding the date syntax in with the date for the event start time. (I'm not showing the date range, I took out the whole 'from/to' portion.) Here is how I want it to display, and how it currently does display (but the time is off by an hour at the moment):
Quote:
Saturday, May 1st, @ 9:00 AM
For some reason, it is calculating this with a GMT of -5, when I have a GMT of -6. Both my admincp, user profile, and my calendar have the right time displayed, just not the widget. I CAN go in and hard code a variable for the hour and subtract one from it, however that still screws up my AM/PM display, etc...
Here is the code I'm using to display the starting date and time:
Code:
$format = sprintf("%s",date('l, F jS, @ g:i A',$event['dateline_from']));
How can I get this to calculate the correct time? Why doesn't it display the same time as in the calendar itself? How can I fix this?