Back to vBulletin 4.x Add-ons

UpComing Events SideBlock/Bar With/Without Image
Mod Version: 1.10, by ProFifaLeagues

vB Version: 4.0.0 Rating: (16 votes - 4.31 average) Installs: 96
Released: 06 Nov 2010 Last Update: Never Downloads: 0
Not Supported Re-usable Code Translations  

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);   

$event_get vB::$db->query_read($query); 

$output_bits ''
while(
$event vB::$db->fetch_array($event_get)) { 

     if(
$event['dateline_to'] == 
     { 
         
$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
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);   

$event_get vB::$db->query_read($query); 

$output_bits ''
while(
$event vB::$db->fetch_array($event_get)) { 

     if(
$event['dateline_to'] == 
     { 
         
$format sprintf("On %s%s %s %s",date("j",$event['dateline_from'])+1date("S",$event['dateline_from']), date("M",$event['dateline_from']), date("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"><center><a href="calendar.php?do=getinfo&e=%d"><img src="attach/images/misc/stub.png" width="200px" alt="Upcoming Event"/><h4 class="cms_widget_post_header">%s</a></h4> 
            <p class="cms_widget_post_content">%s</p></center>
        </div> 
        '
,$event['eventid'],$event['title'],$format); 


$output $output_bits


ob_end_clean(); 
return 
$output
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);   

$event_get vB::$db->query_read($query); 

$output_bits ''
while(
$event vB::$db->fetch_array($event_get)) { 

     if(
$event['dateline_to'] == 
     { 
         
$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"><center><a href="calendar.php?do=getinfo&e=%d"><img src="attach/images/misc/stub.png" width="200px" alt="Upcoming Event"/><h4 class="cms_widget_post_header">%s</a></h4> 
            <p class="cms_widget_post_content">%s</p></center>
        </div> 
        '
,$event['eventid'],$event['title'],$format); 


$output $output_bits


ob_end_clean(); 
return 
$output

Download

No files for download.


vblts.ru supports vBulletin®, 2022-2024