So, I'm not really sure where my database column 'lastlogin' came from lol but me and my friend had one and neither of us could remember, nor was it functional that we could tell, and I was frustrated because I was really wanting a "Last Worked: (date here)" on my user profiles. So I figured out how to get it to work! So, if you want a Last Active or a thing for a date to be shown somewhere that updates each day, this is what I got working.
(If this lastlogin was part of a mod we don't remember, and you have that mod, just change lastlogin to whatever you want and change the rest of the code with lastlogin to that new name)
Onwards! Let's do database stuff first.
Go to your users_profile table, then to Structure, and add a new column:
lastlogin | VARCHAR | 25 | Default: Define as ?
enter.
Go to class_userprofile.php and add this above your bio info:
(If this lastlogin was part of a mod we don't remember, and you have that mod, just change lastlogin to whatever you want and change the rest of the code with lastlogin to that new name)
Onwards! Let's do database stuff first.
Go to your users_profile table, then to Structure, and add a new column:
lastlogin | VARCHAR | 25 | Default: Define as ?
enter.
Go to class_userprofile.php and add this above your bio info:
$date = new DateTime;
$mysidia->db->update("users_profile", array("lastlogin" => $date->format("m-d-Y")), "uid = '{$mysidia->user->uid}'");
$lastlogin = $mysidia->db->select("users_profile", array("lastlogin"), "username = '{$mysidia->input->get("user")}'")->fetchColumn();
Then in the bio, this:
<br>Last worked: {$lastlogin}
And that's it! You can change the m-d-Y area to display how you want, just make sure the year is capital Y. I like it to display month first, then day, then year. But apparently default is: year, day, month, and my brain doesn't like that lol.
Attachments
Last edited: