Register Members List Search Today's Posts Mark Forums Read

Reply
 
Mod Options
Countdown to Dates Plugin Details »
Countdown to Dates Plugin
Mod Version: 1.00, by jamoss (Coder/Designer) jamoss is offline
Developer Last Online: Jul 2019 I like it Show Printable Version Email this Page

This modification is in the archives.
vB Version: 3.6.8 Rating: (4 votes - 4.00 average) Installs: 23
Released: 16 Sep 2007 Last Update: Never Downloads: 9
Not Supported  

Based on Sinclair's hack: http://www.vbulletin.org/forum/showthread.php?t=40557

I modified it to make it a plug-in for 3.6 +

Usage:
Users enter the code [countdown]y,m,d[/countdown]

Example:
[countdown]2007,12,25[/countdown] Christmas!

ONLY ONE STEP: EASY!

Go to your admin panel and CREATE NEW PLUGIN.

- Hook Location: BBCODE_PARSE_COMPLETE

- Enter this code in the PHP code box:
preg_match("/(\[)(countdown)(])(\r\n)*([^\"]*)(\[\/countdown\])/siU", $text, $datum);

$dato=$datum[0];

$datr=explode(",",$dato);

$datr[0]=str_replace("[countdown]", "", $datr[0]);
$jahr=intval($datr[0]);
$monat=intval($datr[1]);
$tag=intval($datr[2]);
$stunde=intval($datr[3]);
$minute=intval($datr[4]);
$sekunde=intval($datr[5]);
$target = mktime($stunde,$minute,$sekunde,$monat,$tag,$jahr);
$todayo = mktime(0,0,0,date("m"),date("d"),date("Y"));
$diff = ($target - $todayo)/86400;
if ($todayo==$target) { $out= "TODAY "; }
else if ($diff==1) { $out = "1 day until "; }
else if ($diff==(-1)) { $out = "1 day since "; }
else {
if ($diff>0) {
$diff=round($diff,0);
$out="$diff days until ";
}
if ($diff<0) {
$diff=round(-$diff, 0);
$out="$diff days since ";
}
}

$text = preg_replace("/(\[)(countdown)(])(\r\n)*([^\"]*)(\[\/countdown\])/siU", $out, $text);
That's it! Now announce to your users they can use that code.

Download Now

Only licensed members can download files, Click Here for more information.

Show Your Support

  • To receive notifications regarding updates -> Click to Mark as Installed.
  • This modification may not be copied, reproduced or published elsewhere without author's permission.
Comments
  #2  
Old 16 Sep 2007, 22:29
FreshFroot's Avatar
FreshFroot FreshFroot is offline
 
Join Date: Aug 2005
interesting stuff, will have to try it and see.

thanks.
Reply With Quote
  #3  
Old 16 Sep 2007, 23:32
El Burro's Avatar
El Burro El Burro is offline
 
Join Date: Apr 2007
Installed and working.

Just difficult to explain use as [countdown] still works inside [code]

Thanks
Reply With Quote
  #4  
Old 17 Sep 2007, 03:06
SMO's Avatar
SMO SMO is offline
 
Join Date: Sep 2005
Real name: Geoff
how hard you think it is to make this a vba module?
Reply With Quote
  #5  
Old 17 Sep 2007, 06:59
Floris Floris is offline
 
Join Date: Jan 2002
Small question, if I visit the thread where [countdown] has been used a few days later, will it then say instead of 14 days until October ... 12 days until october? Or is it a one time thing?
__________________
My community; http://wetalknation.net
Reply With Quote
  #6  
Old 17 Sep 2007, 08:05
Floris Floris is offline
 
Join Date: Jan 2002
When I go back to the thread at a later time, it stops working .. it becomes plaintext again. I think this mod is super alpha, and hasn't been fully tested, I am sorry .. but I feel I have to uninstall it right now and wait a few updates before using it again.
__________________
My community; http://wetalknation.net
Reply With Quote
  #7  
Old 17 Sep 2007, 08:34
El Burro's Avatar
El Burro El Burro is offline
 
Join Date: Apr 2007
I'm uninstalling too.
Sorry it's no good if it doesn't keep changing the countdown.
Reply With Quote
  #8  
Old 17 Sep 2007, 11:08
bazzup bazzup is offline
 
Join Date: Dec 2006
Real name: bazz
looks a good prospect i just use the sig countdown timer at the moment but will use this if it gets sorted
Reply With Quote
  #9  
Old 17 Sep 2007, 19:04
stonner stonner is offline
 
Join Date: Jun 2006
can anyone provide a screeshot or demolink?

thank you
Reply With Quote
  #10  
Old 17 Sep 2007, 20:35
thincom2000 thincom2000 is offline
 
Join Date: Jun 2006
Real name: Ted
Why isn't this a bb-code? That would fix a lot of issues, and I would install it if it was.

Check out /includes/class_bbcode.php (particularly the end) for some ideas. You would make this a function and add it to the bbcode_create hook (trust me, don't use the bbcode_fetch_tags hook -- it would conflict with many mods). Then use the 'external_callback' field to connect the function to your bbcode. Oh, and you will need to disable post caching (even in your current code).

Add to your bbcode function: $parser->options['cachable'] = false;
Reply With Quote
  #11  
Old 17 Sep 2007, 20:45
jamoss's Avatar
jamoss jamoss is offline
 
Join Date: Apr 2002
Real name: Jennifer
Thanks for the feedback! I'll check out the bugs.
__________________
Jennifer M. - php developer since '98
Reply With Quote
  #12  
Old 18 Sep 2007, 08:44
Hornstar's Avatar
Hornstar Hornstar is offline
 
Join Date: Jun 2005
Real name: Matt
I'll keep an eye on this. thanks.
Reply With Quote
  #13  
Old 29 Sep 2007, 12:50
PinkDaisy's Avatar
PinkDaisy PinkDaisy is offline
 
Join Date: Sep 2006
Can this work in a sigature??
Reply With Quote
  #14  
Old 29 Sep 2007, 13:16
wickedstangs wickedstangs is offline
 
Join Date: Mar 2007
Real name: Emilio
Installed and seems to be working fine on vBulletin® Version 3.6.8
__________________
www.mustangsvstheworld.com
Reply With Quote
  #15  
Old 30 Sep 2007, 22:05
Masiello's Avatar
Masiello Masiello is offline
 
Join Date: Jul 2005
Real name: Antonio
Originally Posted by Floris View Post
When I go back to the thread at a later time, it stops working .. it becomes plaintext again. I think this mod is super alpha, and hasn't been fully tested, I am sorry .. but I feel I have to uninstall it right now and wait a few updates before using it again.
Same here damn, it's be good for my board when code is fixed.
vB 3.6.8
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Mod Options

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


New To Site? Need Help?

All times are GMT. The time now is 04:56.

Layout Options | Width: Wide Color: