Log in

View Full Version : Help Me, Please!!


v123shine
02-17-2011, 03:14 PM
Helo,
I have ads banner in my site, i want to disable ads banner from 1 PM untill 3 PM, is it possible to disable ads in custom time?

Thank You

kh99
02-17-2011, 04:32 PM
You could do something like this: make a new plugin using hook global_start and this code:


// Uncomment only one of these...
$hourdiff = intval($vbulletin->options['hourdiff']); // User's local time
//$hourdiff = (date('Z', TIMENOW) / 3600) * 3600; // Default (using "Default Time Zone Offset")
//$hourdiff = 0; // Server Time

$thishour = date("G", max(0, time() - $hourdiff));
$show['timed_banner'] = ($thishour < 13 || $thishour >= 15);


(ETA: Made a change in the above to "$thishour >= 15", originally would have hidden banner between 1PM and 4 PM).

And then in the template put

<if condition="$show['timed_banner']">
...
</if>

around the part you want affected by the time.

The plugin part has three options: the way it is, it will use the user's local time (based on the time zone they have chosen in their profile), but you can choose the default time zone (from the Date Time settings), or just the server's time.

Naan-Kadavul
02-17-2011, 09:48 PM
There is no such thing..on time limit..you have to do manually.