Back to vBulletin 3.6 Add-ons

Countdown to Dates Plugin
Mod Version: 1.00, by jamoss

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

Based on Sinclair's hack: index.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

No files for download.


vblts.ru supports vBulletin®, 2022-2025