Jump to the post that solved this thread.
Solved: 6 Years, 6 Months, 4 Weeks ago Days Online
#1
Solved: 6 Years, 6 Months, 4 Weeks ago
I'd like to display forum up online days in the footer... for example if my forum has been up online running for a year then in the footer I'd like it to say 365 Days Online.

I've seen it done before in some forums not sure if it's a plugin or can it be done with php?

Thank you.
Do NOT PM me for support unless I ask you on your support thread.
Reply
#2
Solved: 6 Years, 6 Months, 4 Weeks ago
It is a plugin Livewire coded by Neo
https://community.mybb.com/mods.php?action=view&pid=937
- MyBB Heart
Reply
#3
Solved: 6 Years, 6 Months, 4 Weeks ago
I added something simulair in the section 'Board statistics' on te bottom of the index page:

'This forum is online for xxx days (started on xx-xx-xxxx)'

I did this by editing the 'index_stats' template to the following:

<tr><td class="tcat"><span class="smalltext"><strong>{$lang->boardstats}</strong></span></td></tr>
<tr>
<td class="trow1"><span class="smalltext">
{$lang->stats_posts_threads}<br />
{$lang->stats_numusers}<br />
{$lang->stats_newestuser}<br />
{$lang->stats_mostonline}<br />
This forum is online for <script type="text/javascript"> var eventdate = new Date("May 13, 2009 00:00:00 GMT");d=new Date();count=Math.floor((d.getTime()- eventdate.getTime())/1000);count=Math.floor(count/(60*60*24));document.write(count);</script> days (started on may 13th 2009).<br />
</span>
</td>
</tr>

Maybe you can do it likewise? You just have to adjust your own dates.......
Reply
#4
Solved: 6 Years, 6 Months, 4 Weeks ago
Fairly, your site start date is the registration date of your UID 1. So you can use that.
Add these 3 lines at the end of your global.php

$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = nice_time(TIME_NOW - $sitestart['regdate']);

Now you can use {$siteup} anywhere in your templates which will produce something like 3 Weeks, 3 Days, 11 Hours
Hard code or play with language files to prepend texts like "Site uptime:"
Reply
#5
Solved: 6 Years, 6 Months, 4 Weeks ago
(2018-05-10, 08:58 AM)effone Wrote: Fairly, your site start date is the registration date of your UID 1. So you can use that.
Add these 3 lines at the end of your global.php

$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = nice_time(TIME_NOW - $sitestart['regdate']);

Now you can use {$siteup} anywhere in your templates which will produce something like 3 Weeks, 3 Days, 11 Hours
Hard code or play with language files to prepend texts like "Site uptime:"

I guess that's what I was looking for and it worked thank you, but how can I remove weeks/days/hours? Instead I want it to say Days for example 300 days... 600 days.. 1000 and so on.
Do NOT PM me for support unless I ask you on your support thread.
Reply
#6
Solved: 6 Years, 6 Months, 4 Weeks ago
Try this:

$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = "Site online: <strong>".floor((TIME_NOW - $sitestart['regdate'])/86400)." days</strong>";

You may also like to cache the data to save a query in every page load.
Reply
#7
Solved: 6 Years, 6 Months, 4 Weeks ago
(2018-05-11, 06:16 AM)effone Wrote: Try this:

$query = $db->simple_select('users', 'regdate', 'uid=1', array('limit' => 1));
$sitestart = $db->fetch_array($query);
$siteup = "Site online: <strong>".floor((TIME_NOW - $sitestart['regdate'])/86400)." days</strong>";

You may also like to cache the data to save a query in every page load.

Thanks pal. Smile
Do NOT PM me for support unless I ask you on your support thread.
Reply
Jump to the post that solved this thread.


Forum Jump:


Users browsing this thread: 1 Guest(s)