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
  #92  
Old 04-30-2012, 06:17 PM
mgurain's Avatar
mgurain mgurain is offline
 
Join Date: Apr 2005
Location: KSA - Qatif - Al-Jarodiah
Posts: 345
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

It did not show anything to me !
Reply With Quote
  #93  
Old 06-13-2012, 03:51 AM
edytwinky edytwinky is offline
 
Join Date: Aug 2007
Posts: 512
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

has this been updated to show birthdays?
Reply With Quote
  #94  
Old 06-13-2012, 03:56 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 edytwinky View Post
has this been updated to show birthdays?

No mate but its something you can quickly add in the code if needed.
Reply With Quote
  #95  
Old 06-13-2012, 07:50 AM
dlewisr dlewisr is offline
 
Join Date: Mar 2011
Posts: 88
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Nice mod. Installed (4.2.0 (Patch 1) and rated

Thank you.
Reply With Quote
Благодарность от:
ProFifaLeagues
  #96  
Old 07-07-2012, 09:11 PM
Alibass's Avatar
Alibass Alibass is offline
 
Join Date: Mar 2007
Posts: 615
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works great on 4.2.0 PL2 :up:

Thanks...
Reply With Quote
Благодарность от:
ProFifaLeagues
  #97  
Old 08-01-2012, 12:16 AM
yoximusprime yoximusprime is offline
 
Join Date: Jul 2012
Posts: 5
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Does this update automatically? I've gotten it looking fine but if I add or remove events it doesn't seem to correct itself.
Reply With Quote
  #98  
Old 08-01-2012, 04:44 AM
ProFifaLeagues's Avatar
ProFifaLeagues ProFifaLeagues is offline
 
Join Date: Aug 2009
Location: Uk
Posts: 1,191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yes mate auto updates with any events you have
Reply With Quote
  #99  
Old 08-02-2012, 08:03 PM
Alibass's Avatar
Alibass Alibass is offline
 
Join Date: Mar 2007
Posts: 615
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have an event scheduled for 2nd Nov 2012 but the display shows 2st Nov 2012 because of the time stamp being on the first.

Is there away to fix this so it displays correctly?

Thanks in advance.

WD
Reply With Quote
  #100  
Old 08-04-2012, 02:56 AM
Alibass's Avatar
Alibass Alibass is offline
 
Join Date: Mar 2007
Posts: 615
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Alibass View Post
I have an event scheduled for 2nd Nov 2012 but the display shows 2st Nov 2012 because of the time stamp being on the first.

Is there away to fix this so it displays correctly?

Thanks in advance.

WD
@ProFifaLeagues

I know you do not support this mod but you must have run across this issue somewhere along the line.
Reply With Quote
  #101  
Old 08-04-2012, 04:35 AM
ProFifaLeagues's Avatar
ProFifaLeagues ProFifaLeagues is offline
 
Join Date: Aug 2009
Location: Uk
Posts: 1,191
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try using this 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);

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

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

if(
$event['dateline_to'] == 0 )
{
$format = sprintf(" ");
// $format = sprintf("On %s",date('jS M Y',$event['dateline_from'])); <-- broken/disabled
} 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"><h4 class="cms_widget_post_header"><font size="2">%s</font></a></h4>
<p class="cms_widget_post_content"><font size="1">%s </font></p><p><font size="1">&nbsp;</font></p></center>
</div>
'
,$event['eventid'],$event['title'],$format);

}
$output = $output_bits;

ob_end_clean();
return
$output;
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 08:10 PM.


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.13291 seconds
  • Memory Usage 2,392KB
  • Queries Executed 28 (?)
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
  • (3)bbcode_php
  • (2)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
  • (5)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)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_postinfo_query
  • fetch_postinfo
  • 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