Mys 1.3.5 Last Login Mod

Forum
Last Post
Threads / Messages

GeneticAlpha

Loving Mysidia!
Member
Joined
May 24, 2020
Messages
287
Points
18
Age
31
Location
Tennessee
Mysidian Dollar
13,377
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:

$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

  • login.png
    login.png
    1.3 MB · Views: 8
Last edited:

Similar threads

Users who are viewing this thread

  • Forum Contains New Posts
  • Forum Contains No New Posts

Forum statistics

Threads
4,274
Messages
33,114
Members
1,602
Latest member
BerrieMilk
BETA

Latest Threads

Latest Posts

Top