Go Back   vb.org Archive > vBulletin Modifications > vBulletin 4.x Modifications > vBulletin 4.x Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
UpComing Events SideBlock/Bar With/Without Image Details »»
UpComing Events SideBlock/Bar With/Without Image
Version: 1.10, by ProFifaLeagues ProFifaLeagues is offline
Developer Last Online: Nov 2023 Show Printable Version Email this Page

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

$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="http://www.YourForum.com/forum/images/event.jpg" 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="http://www.YourForum.com/forum/images/event.jpg" 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

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.
3 благодарности(ей) от:
ggrimes620, NoMatt3r, Toxic2

Comments
  #72  
Old 05-24-2011, 01:45 PM
Mark4865's Avatar
Mark4865 Mark4865 is offline
 
Join Date: Sep 2010
Location: South-Africa
Posts: 289
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Okay Update:

I discovered the code I was using for the image is for a single image event and it will only show the same image for every event in the widget, although I still havent got it to show in the widget.

My question is does anyone know how to write the code so a different image for every event will show in the widget. I have the image showing up perfectly in the actual event does someone know what code to use to get the same image to show in the widget.

Desperate please
Reply With Quote
  #73  
Old 05-27-2011, 01:28 PM
TransAmDan TransAmDan is offline
 
Join Date: Nov 2009
Posts: 34
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way to display repeated events correctly?
We have an event every 2 weeks on a Tuesday, it displays fine in the calendar. However on the events list it displays

Club Night
From 7th Jun 2011 to 30th Dec 2012

It displays the start and end of the reoccurring event, but not the date it is on.
Reply With Quote
  #74  
Old 06-05-2011, 12:29 PM
RedTrinity's Avatar
RedTrinity RedTrinity is offline
 
Join Date: Mar 2008
Location: QLD, Australia
Posts: 265
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by TransAmDan View Post
Is there any way to display repeated events correctly?
We have an event every 2 weeks on a Tuesday, it displays fine in the calendar. However on the events list it displays

Club Night
From 7th Jun 2011 to 30th Dec 2012

It displays the start and end of the reoccurring event, but not the date it is on.
Having the same issue. Today is June 5th, and all I have displaying in our events box is the following recurring events from as early as March 1st....

Quote:
N & D's wedding anniversary
From 1st Mar 2010 to 1st Mar 2013

E's birthday
From 3rd Mar 2010 to 3rd Mar 2020

J's Birthday
From 16th Mar 2010 to 16th Mar 2020

T & L's Wedding Anniversary
From 19th Apr 2010 to 19th Apr 2013

C's birthday
From 9th Jun 2010 to 9th Jun 2020
Kind of defeats the purpose of the mod when the events don't update Which is a shame, because its a great mod concept....
Reply With Quote
  #75  
Old 06-12-2011, 01:45 PM
Mark4865's Avatar
Mark4865 Mark4865 is offline
 
Join Date: Sep 2010
Location: South-Africa
Posts: 289
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hello,

Just noticed my dates are showing incorrectly as it shows 1 day late so I put in say 12/06 in the event but in the widget is shows 13/06. Code shown below how do I fix this please

ob_start();

// %d
$show_count = 10;

$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%s %s %s",date("j",$event['dateline_from'])+1, date("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"><a href="calendar.php?do=getinfo&e=%d"><img src="http://www.porscheplanet.co.za/images/misc/motorsport.gif" width="75" height="60" alt="Upcoming Event" HSPACE="7" VSPACE="3" align="left"/><h4 class="cms_widget_post_header"><b>%s</b></a></h4>
<p class="cms_widget_post_content"><b>%s</b></p>

</div> <BR/><BR/>
',$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();
return $output;
Reply With Quote
  #76  
Old 06-12-2011, 02:24 PM
tomsch tomsch is offline
 
Join Date: May 2003
Posts: 60
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Mark4865 View Post
Hello,

Just noticed my dates are showing incorrectly as it shows 1 day late so I put in say 12/06 in the event but in the widget is shows 13/06. Code shown below how do I fix this please
as have said before the query used does not work properly in some cases.

there is a small "bug" in the way events sre stored for single day events as well as the query used to get the events does not adjust for time zone. the "bug" has been reported and is now confirmed. if you use the query for the other upcoming events widget i have posted you should have better luck with the dates.
Reply With Quote
  #77  
Old 06-12-2011, 04:26 PM
Mark4865's Avatar
Mark4865 Mark4865 is offline
 
Join Date: Sep 2010
Location: South-Africa
Posts: 289
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by tomsch View Post
as have said before the query used does not work properly in some cases.

there is a small "bug" in the way events sre stored for single day events as well as the query used to get the events does not adjust for time zone. the "bug" has been reported and is now confirmed. if you use the query for the other upcoming events widget i have posted you should have better luck with the dates.
Thanks for info tomsch appreciate it, any chance you can tell me what sections to change on my code as I have everything set up the way I need it just the date issue. Sorry hope I am not taking advantage here
Reply With Quote
  #78  
Old 06-16-2011, 02:08 AM
oldfan's Avatar
oldfan oldfan is offline
 
Join Date: Jul 2004
Posts: 813
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ive tried and tried and I cannot get the block to show up
Reply With Quote
  #79  
Old 06-20-2011, 07:20 AM
ProFifaLeagues's Avatar
ProFifaLeagues ProFifaLeagues is offline
 
Join Date: Aug 2009
Location: Uk
Posts: 1,191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by oldfan View Post
Ive tried and tried and I cannot get the block to show up

Oldfan I see your having the same issues with other mods for the forum block too,if you wish to send me some login info for your admin cp i will come across and add this for you later today.
Reply With Quote
  #80  
Old 06-22-2011, 12:17 PM
oldfan's Avatar
oldfan oldfan is offline
 
Join Date: Jul 2004
Posts: 813
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for getting mine to work and adding the custom welcome block rammieone !!
Reply With Quote
  #81  
Old 07-28-2011, 07:13 PM
netzwart's Avatar
netzwart netzwart is offline
 
Join Date: Aug 2010
Posts: 20
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This MOD is working fine in vB 4.0.8 ! Thank you !!!

However, there are two questions left:

1. The dates are shown in english, not in the selected language german, e. g. January instead of Januar. How can I change this ?

2. Is it possible to place the date in front of the event title ? I tried to change the order of the following lines, but it did not work:

Code:
<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>
Thank you in advance!

Netzwart
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:03 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06450 seconds
  • Memory Usage 2,384KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_code
  • (3)bbcode_php
  • (5)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (3)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete