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

[MOD] Last Visit 3.0

61 Posts
22 Users
0 Likes
27.7 K Views
 Elle
(@jenny)
Posts: 594
Honorable Member
 

That's standard.

profile.php:

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

That's what I have though.

archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 14/04/2009 3:50 pm
(@itanshi)
Posts: 381
Reputable Member
 

Ah, that worked, thanks. I also made sure to mark all my mods more clearly this time ^^

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 14/04/2009 4:15 pm
(@tmelange)
Posts: 74
Trusted Member
 

Hi, I'm finding this thread a bit confusing. Do I follow the instructions in the first post or do I have to work through each reply to try to get this to work? The download link in the first post is dead.

Anyway, if anyone knows how best to acquire the install instructions for this sort of last visit mod, please advise. Thanks!

 
Posted : 05/09/2010 1:36 am
 Elle
(@jenny)
Posts: 594
Honorable Member
 

Try this one:

1. Alter fanfiction_authors table; in phpMyAdmin's SQL box, paste this:

ALTER TABLE `fanfiction_authors` ADD `lastlog` DATETIME NOT NULL ;

(This creates the lastlog column.)

2. Insert a new row into fanfiction_codeblocks:

INSERT INTO fanfiction_codeblocks VALUES ('', '$update_lastlog = dbquery("UPDATE `".TABLEPREFIX."fanfiction_authors` SET lastlog = now() WHERE uid = '$passwd[uid]' LIMIT 1");', 'login', 'lastvisit');

(This will update the lastlog column when the person logs in.)

3. Open up includes/get_session_vars.php; look for:

		define("USERUID", $userdata['uid']);

And paste this after:

		// Last visit mod
$update_lastlog = dbquery("UPDATE ".TABLEPREFIX."fanfiction_authors SET lastlog = now() WHERE uid = '".USERUID."' LIMIT 1");
// end Last visit mod

x2

(This will update the lastlog column at every page hit.)

4. Open up user/profile.php; find:

$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);

Add after:

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'])));

archive: dramione.org
site: accio.nu

Available for skin/mod commission! πŸ™‚

 
Posted : 05/09/2010 1:23 pm
(@tmelange)
Posts: 74
Trusted Member
 

Elle, you rock! Thank you so much! I will study this and see if I can get it to work.

 
Posted : 05/09/2010 2:44 pm
(@blayde)
Posts: 41
Eminent Member
 

Sorry to revive a super old thread..

But if there's anyone out there still using this mod and got it to work properly,
do you mind sharing how you got rid of the "December 31, 1969" date issue?
This is a useful mod, but like others who posted on this thread before, I get
stuck with one of four outcomes:

Either the date stays stuck on:

December 31, 1969 (The OP's original mod)
0000-00-00 00:00:00 (A workaround Seiji posted)
November 30 -0001 (A summary of mod codes posted by Elle)
_UNAVAILABLE (I forget which coding got me here)

Quick facts:

I tested this on 2 different archives (3.3.1 and 3.5.3 -the former is my 'real' site) with the same results.

My admin account -on both sites- gave the right date and updated, but no other account did.
(I made test accounts and tried logging in and out several times after each code adjustment.)

I'm not at all php savvy (quite the opposite), but I was able to tell through phpmyadmin that my
admin account updated on the lastlog column, but again, only mine. No one else.

I also had my 'real' site open at the time, and people were logged in, but their profiles didn't reflect
any date changes, either.

So, if anyone even remembers this mod, do you recall how you were able to fix it?

Thanks...

 
Posted : 09/03/2013 12:05 pm
(@lyndsie)
Posts: 1262
Member Moderator
 

I haven't dug into this mod but I can tell you that December 31, 1969 is basically the first date that most (linux) servers can display and basically equates to a 0, so that to me sounds like the date information just isn't getting into the database. You can check the database to confirm this. That doesn't really narrow the problem down, unfortunately.

Here is why that date means something: http://mentalfloss.com/article/26316/why-does-my-gadget-say-its-december-31-1969

If you did things the way that Elle shows, ask her about this part as I'm not sure it's purpose.


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'])));
 
Posted : 09/03/2013 5:00 pm
(@blayde)
Posts: 41
Eminent Member
 

Thank you for the reply and the link. ^^

I'm going to shoot Elle a PM, and if she isn't busy, hopefully
she can provide some insight about that part of her code.
The OP's code was easy enough to follow, but when I got
stuck on that date, I realized that I wasn't the only one...

 
Posted : 09/03/2013 5:22 pm
(@itanshi)
Posts: 381
Reputable Member
 

It's possible many of these newly noticed problems are from out of date php code.

http://php.net/manual/en/function.strtotime.php

http://www.php.net/manual/en/function.date.php

Hmm looking again. Its checking if the value is 0'd out, if it isn't it makes it say 'unavailable'. For some odd reason the last log is stored using words instead of the format the 0's are in which is the mysql default.

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 09/03/2013 7:03 pm
(@blayde)
Posts: 41
Eminent Member
 

I totally wish I had a clue as to what you just told me.  πŸ˜†
I know jack about php/mysql stuff. I pretty much followed
the directions in the thread and got to all those end results.
The '1969' thing happened to people from the very start, but
it seems like a few people got the mod to work... just not me. lol.

 
Posted : 09/03/2013 10:11 pm
(@itanshi)
Posts: 381
Reputable Member
 

i always had a fear of programming, but I assure you its a lot easier to learn than you'd think. But do what you do best, by all means.

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 10/03/2013 12:02 am
(@blayde)
Posts: 41
Eminent Member
 

This time 3 years ago I was a LOT worse off. I learned efic
alone (which was huge for me since I'm not very techie),
and with the exception of this mod and my wacky DB issues
lately, I've been able to apply all my small fixes with no trouble.
I hope to eventually graduate to php and hard-coding, but
everything is a process. πŸ™‚

 
Posted : 10/03/2013 3:50 am
(@itanshi)
Posts: 381
Reputable Member
 

These days, frameworks liek laravel and codeigniter make me realize efic is code spaghetti. its a mess.

I am rebuilding efiction! Join us on irc! #efiction at www.mibbit.com Instructions for irc πŸ˜€ Alpha released!

 
Posted : 10/03/2013 4:30 am
 SJP
(@sjp)
Posts: 66
Trusted Member
 

I just installed this mod and got the default date to work, so I thought I'd update this in case you were still looking for a solution. This is all still really new to me, so I can't guarantee it's the right thing to do, but it worked, so I'm happy :-). I followed Elle's instructions and just like you, I got November 30 -0001 as the default date for those who hadn't logged in yet. I went back into the database and replaced the generic 0000-00-00 00:00:00 that populated the lastlog column as a default with a random date that I chose (I used Jan 01, 2013) just to have a real date that would show authors who haven't logged in since I added the mod. I went to the SQL box and entered the following code:

UPDATE fanfiction_authors SET lastlog = replace(lastlog,"0000-00-00 00:00:00","2013-01-01 22:10:05")

This replaced all the default 0000-00-00 00:00:00 entries and with correct date format shown as the date I selected.

Hope this helps.

 
Posted : 21/03/2013 12:24 am
(@blayde)
Posts: 41
Eminent Member
 

Sorry for the late reply. I haven't been here in weeks,
so I'm only seeing this now. Thanks a lot for the tip! I
never did get this to work correctly and pretty much
gave up, but I'm going to give your solution a try and
see how it goes.

Thanks again!  πŸ˜€

EDIT: Unfortunately, it's still not updating.
Even after running that date command, when someone logged in,
there was no change in the login date on their profile. Totally have
no idea how to make this work properly...

EDIT DEUX: Looks like I finally may have gotten it to work. I'll know when more people login.
Turns out, I had done one of the database steps incorrectly. I tried running it in the SQL box
and it seems to have worked this time. I'll know more in a few days.

 
Posted : 29/05/2013 11:54 am
Page 4 / 5
Share: