Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Clock extension?
I don't entirely understand the whole extension system yet, would anyone be interested in writing a simple clock extension that would show up at the bottom of the control panel? I need to display GMT time on my forums for deadlines and such, and right now we're all just kind of guessing in our heads.
0
This discussion has been closed.
Comments
It's not too difficult, I'll write it up and post it here in a few minutes.
<?php /* Extension Name: Clock Extension Url: http://lussumo.com/docs/ Description: Adds a clock to the control panel. Version: 1.0 Author: Mark O'Sullivan Author Url: http://markosullivan.ca/ */ if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php"))) { $Time = time(); $GMT = date('Y-m-d H:i:s', ($Time + date("Z", $Time))); $Panel->AddString('<div style="padding: 0px; margin: 0px; text-align: center; color: #aaaaaa;">' .$GMT .'</div>' , 500); } ?>
If you were going to try to do this in 0.9.2, you'd need to remove that ", 500" at the end of the AddString method.
Note that the time is formatted using php's date function. Refer to that link if you want the time formatted in some other way.
To make an extension out of that code, just create a file called Clock.php in your extensions directory, and paste that code into it. Then sign into vanilla as an administrator, go to settings > manage extensions, and enable it.
*slaps forehead*
<? if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php"))) { $GMT = gmdate('l H:i (g:i a)'); $Panel->AddString('<div style="padding: 0px; margin: 0px;"><h2>Forum Time</h2><span style="margin-left: 2px;">' .$GMT .'</span></div>'); } ?>
<?php if (in_array($Context->SelfUrl, array("account.php", "categories.php", "comments.php", "index.php", "post.php", "search.php"))) { $Panel->AddString('<div style="padding: 0px; margin: 0px;"><h2>Forum Time (GMT)</h2><span style="margin-left: 2px;">' .$GMT = gmdate('l H:i (g:i a)') .'</span></div>'); } ?>
There we go.