[MOD] Last Visit 3....
 
Notifications
Clear all

[MOD] Last Visit 3.0

61 Posts
22 Users
0 Reactions
28.9 K Views
 SJP
(@sjp)
Posts: 66
Trusted Member
 

I just wanted to update this so that there's an answer if someone comes back to the thread. I posted a solution above of replacing all the instances of "0000-00-00 00:00:00" in the database so that it wouldn't show Dec. 31, 1969 or Nov. 30, -0001. However, I figured out a different solution that should allow you to keep the original dates intact, even if they're "000-00-00".

I had been using Elle's code that was posted above:

if (date("$dateformat", strtotime($userinfo['lastlog'])) == date("$dateformat", "0000-00-00 00:00:00")) $tpl->assign("lastlog", "Unavailable");   
else $tpl->assign("lastlog", date("$dateformat", strtotime($userinfo['lastlog'])));

which showed as November 30, -0001 on profile pages for members who had not logged in. That's why I did the database replacement to an actual date as mentioned in my previous post.

I changed it to:

if (date("$dateformat", strtotime($userinfo['lastlog'])) == date("$dateformat", strtotime("0000-00-00 00:00:00"))) $tpl->assign("lastlog", "Unavailable");   
else $tpl->assign("lastlog", date("$dateformat", strtotime($userinfo['lastlog'])));

and this fixed the November 10, -0001 issue. It started showing Unavailable for all users who had not yet logged in, so I did another database change and replaced all occurrences of the made up date I used "2013-01-01 22:10:05" with "0000-00-00 00:00:00" since the unavailable entry was more accurate.


 
Posted : 15/06/2013 2:12 pm
Page 5 / 5
Share: