Install date

Started by Bigguy, Nov 16, 2020, 02:26 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bigguy

Is there a way to post the install date of the forum on the stats page. It shouldn't be that hard to do eh. :whi

Oldiesmann

The only way you could get an install date would be to pull the registration date for the member with id_member = 1 (or the lowest id_member in the rare case there is no member with an ID of 1). I'm not sure what would need to be done to get it on the stats page.
Cincy Space - now open! https://www.cincyspace.net

Bigguy

It's an interesting idea to show it there. Maybe I will look into it. :dontknow

Skhilled

A quick look tells me it would most likely go into the /Sources/Stats.php file. Now, exactly where and how to add it? I "assume" you could make a "$context['install_date']" somewhere in the stats file and would have to add the actual text in Modifications.English.php. That would be my guess but I'm no real coder.

Bigguy

Stats.php eh. Well, that's as good a place to start as any. I'll check that out today.

Bigguy

In Stats.php there is this line:

// This would be the amount of time the forum has been up... in days...

$total_days_up = ceil((time() - strtotime($row['date'])) / (60 * 60 * 24));

But I don't see that on the stats page anywhere.

Skhilled

Yeah, I saw that and wondered the same...

Bigguy

Would be nice to use this instead of doing my own somehow.

Skhilled

Try doing the code I posted but use:
$total_days_up
I'm sure it can be done somehow since it is actually collecting that info...

Bigguy

I will hopefully try this later today. I have a few things to do here soon.

Neša

If you find the SQL that created $row['date'] you could run it and just rip out date.
I'm guessing it is a timestamp you can convert it to the users local time with php before you display it.

Bigguy

I'm not that good with sql but I will check out the code a bit more closely.

Neša

Nov 19, 2020, 03:22 AM #12 Last Edit: Nov 19, 2020, 03:37 AM by Neša
They are using the earliest date from the log_activity table.

SELECT
SUM(posts) AS posts, SUM(topics) AS topics, SUM(registers) AS registers,
SUM(most_on) AS most_on, MIN(date) AS date, SUM(hits) AS hits
FROM {db_prefix}log_activity'

You could run:
SELECT MIN(date)
FROM {db_prefix}log_activity

Pure SQL will be this assuming your database name is smf_forum and prefix bup_
SELECT MIN(date)
FROM smf_forum.bup_log_activity

Bigguy

That's very cool. Your really on top of things :rgton :chrs I will play around a bit tomorrow then maybe and see what I can do.  Thanks Nesa.  :)

Neša

I've been writing a website in PHP that will automate one of our manual process'
It is a lot easier for me to navigate PHP files now. I'm almost done after next week I can go back to Java, Ruby, Python, and Rust  :lb