View Full Version : vBulletin Forum Sideblocks - NGG - Upcoming Events - Forum Side Block
betts02
09-02-2010, 10:00 PM
not Supported
Upcoming Events in Forum Block
I recently had a friend make this for me so i DO NOT support this and/or take any credit
I simply show you how to add the "Upcoming Events" in the forum side block
1/ Goto your Admincp
2/ Forums and moderators - Forum Blocks Manager
3/ Add block
4/ Name : Your choice
5/ Active : Yes
6/ Select : PHP
7/ In Content copy and paste :
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);
$event_get = vB::$db->query_read($query);
$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}
$output_bits .= sprintf('
<div class = "cms_widget_post_bit"><h4 class="cms_widget_post_header"><a href="calendar.php?do=getinfo&e=%d">%s</a></h4>
<p class="cms_widget_post_content">%s</p>
</div>
',$event['eventid'],$event['title'],$format);
}
$output = $output_bits;
ob_end_clean();
return $output;
8/ Template top use : block_html
You can see it in action and working here : NGG Clan (http://www.nextgenerationgamers.co.uk/forums/forum.php)
This is on vb4.0.5 and as stated - I can NOT SUPPORT this as i am no coder but i had it made for me at a small price and wanted to share it with the community here
Enjoy and please mark installed and comment if you use it, Cheers
Donations are welcome to betts02@tiscali.co.uk via paypal
betts02
09-03-2010, 06:42 AM
To add, This is showing 1 day before the actual event - If anyone can futher this code to make it on the day, please pm me so i can change the code
Videx
09-03-2010, 11:17 PM
Ya, I had that date issue with the other one too. The author had gone to great pains to try to fix it but the code had become a real mess and it still didn't work right.
Just glancing at this code I wonder if it supports multiple calendars and permissions? We have a Sponsors Calendar that lists advertiser's expiration dates and I wouldn't want that info displayed to everyone.
FatalCure
09-04-2010, 07:51 AM
Fatal error: Class 'vB' not found in /home/public_html/includes/block/html.php(85) : eval()'d code on line 9
Anyone got any idea what I could do to resolve this?
starman?
09-04-2010, 02:54 PM
Why pay for something that doesn't even work properly? Why even post the mod in the first place?
betts02
09-04-2010, 04:08 PM
Its a free mod that needs a little ironing out, it works on my forum as you can see if you goto my site in the link below
v4.0.5 and as stated, NOT SUPPORTED
I can handle the day before while i get it fixed and thought another coder maybe able to futher it more
If you dont like it, Dont use it
ProFifaLeagues
09-04-2010, 05:51 PM
Try this in place of the above in the forum block
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);
$event_get = vB::$db->query_read($query);
$output_bits = '';
while($event = vB::$db->fetch_array($event_get)) {
if($event['dateline_to'] == 0 )
{
$format = sprintf("On %s",date('jS M Y',$event['dateline_from']));
} else {
$format = sprintf("From %s to %s",date('jS M Y',$event['dateline_from']),date('jS M Y',$event['dateline_to']));
}
$output_bits .= sprintf('
%s
%s
',$event['eventid'],$event['title'],$format);
}
$output = $output_bits;
ob_end_clean();
return $output;
This works A1 on the forum blocks on our forum so hope it helps out a little
betts02
09-04-2010, 06:43 PM
Using the above code ends up with - 79 NGG v X UK - MW 2 and not clickable, cheers for trying to help and hopefully someone else can work with this futher
cindy helmond
09-04-2010, 07:21 PM
great !! can you change the coler of the links in the calendar ?
waynehindle
09-07-2010, 08:20 PM
Worked a charm, thanks.
CharlieDelta
10-17-2010, 02:57 AM
Working fine! I have multiple calendars on my forum and there are events that I would not want shown in upcoming events. How would I specify a calendar?
betts02
10-17-2010, 06:53 AM
Maybe check the calendar permissions ?
Will have a look as i dont use this anymore myself and get back to you
Cheers
preswylde
10-18-2010, 10:45 AM
I put this in a sidebar block on my forums and tested it out. It's a great concept if it actually posted the event there reflecting the same day that the event is listed on the calendar. http://www.norcalbots.com/forums have a look and see. In the calendar, I placed a new event titled GAME RELEASE | Call of Duty: Black Ops and set it as an all day event for November 9, 2010 but when it showed up in the block, it shows as the 8th. I probably wouldn't even have noticed the discrepancy if it hadn't been for the COD:Bops game.
Videx
10-18-2010, 12:27 PM
Yes, the date discrepancy is bizarre. Somebody's going to figure it out someday, but until then the only way you can get Upcoming Events to work right anywhere is to copy the original code.
peugeot405
10-31-2010, 07:43 PM
Not working for me. tried the two codes and none is working.
Getting the same error on both
Fatal error: Class 'vB' not found in /home/peugeot405/domains/fsrclan.com/public_html/fsr-test/includes/block/html.php(95) : eval()'d code on line 9
i have vb 4.0.8.
anyone know how to fix this
peugeot405
11-01-2010, 06:50 PM
working perfectly in vb 4.0.7 :)
digibyte
11-05-2010, 04:43 PM
There is an error in the query.
This line:
$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);
should become
$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);
The new query will display multi-day events till the last day of the event.
Zweeper
11-06-2010, 09:46 AM
is this showing the birhtdays as well?
oldfan
06-19-2011, 12:59 PM
Nothing showing up at all
PrincessFiona
11-05-2011, 04:16 PM
Thanks for that fix. I was wondering why I couldn't get mine to work and now it's doing it's job!
phpdesk
01-02-2012, 07:42 PM
Not working for me. tried the two codes and none is working.
Getting the same error on both
Fatal error: Class 'vB' not found in /home/peugeot405/domains/fsrclan.com/public_html/fsr-test/includes/block/html.php(95) : eval()'d code on line 9
i have vb 4.0.8.
anyone know how to fix this
Replace the two instances of vB::$db->[...] with $db->[...]Also add the following line at the top of the code snippet: global $db;
That should work.
mgurain
04-29-2012, 10:54 AM
Could this be supported to make it work in 4.1.12 ?
Regards,,
betts02
04-29-2012, 06:17 PM
Sorry i do not support or even use this anymore
Someone else may be able to help as they have in previous posts
Many thanks
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.