Description: Displays the last date your users visited your eFiction site.
As always my line numbers are approximate and meant to put you in the general ballpark. They will likely change as you progress through the mod.
Requirements: eFiction 3.2 or later
Difficulty: Easy
Mod History:
- 27 February, 2007, Marohi added mod to Test site, bug checking begins
- 1 March, 2007, Posted to eFiction forums
- 2 March, 2007, Fixed cookie issue, added language to en.php, changed mysql_query to dbquery
Files Involved:
- user/login.php
- user/profile.php
- includes/get_session_vars.php
- languages/en.php
- skins/YOUR SKIN/profile.tpl
- database modification
Modification & Support Link: eFiction.org
Instructions:
Database Modifications
FOR NEW INSTALL: For this mod, you will need to alter your database. If you skip this step, THIS WILL NOT WORK!
FOR 2.0 UPGRADE: If you had Seiji's eFiction 2.0 last visit mod installed, you should be able to skip this step.
General Information (for phpMyAdmin, etc.)
- Table: fanfiction_authors
- Field: lastlog
- Datatype: DATETIME
- Null: Not Null
SQL Query:
-
ALTER TABLE `fanfiction_authors` ADD `lastlog` DATETIME NOT NULL ;
Open: user/login.php
Line 1, look for this:
-
<?php
After that, add this:
-
// Mod: Last Visit 3.0 ----------------------------------
Look for this: (line 50)
-
if($passwd['password'] == $encryptedpassword) {
-
$_SESSION[$sitekey."_useruid"] = $passwd['uid'];
After, add this:
-
// Last visit mod
-
$update_lastlog = dbquery("UPDATE ".$tableprefix."fanfiction_authors SET lastlog = now() WHERE uid = '$passwd[uid]' LIMIT 1");
-
// end Last visit mod
Open: includes/get_session_vars.php
Line 1, look for this:
-
<?php
After that, add this:
-
// Mod: Last Visit 3.0 ----------------------------------
Look for this: (line 30)
-
if($userdata && $userdata['level'] != -1 && $_COOKIE[$sitekey.'_salt'] == md5($userdata['email']+$userdata['password'])) {
-
$useruid = $userdata['uid'];
-
$userpenname = $userdata['penname'];
After that, add this:
-
// Last visit mod
-
$update_lastlog = dbquery("UPDATE ".$tableprefix."fanfiction_authors SET lastlog = now() WHERE uid = '$useruid' LIMIT 1");
-
// end Last visit mod
Open: user/profile.php
Line 1, look for this:
-
<?php
After that, add this:
-
// Mod: Last Visit 3.0 ----------------------------------
Look for this (Line 29):
-
$result2 = dbquery("SELECT *, UNIX_TIMESTAMP(date) as date FROM "._AUTHORTABLE." LEFT JOIN ".$tableprefix."fanfiction_authorprefs as ap ON ap.uid = "._UIDFIELD." WHERE "._UIDFIELD." = '$uid' LIMIT 1");
Inside that, look for:
Immediately after that, add this: (Don't forget the comma!)
-
, UNIX_TIMESTAMP(lastlog) as lastlog
Look for this: (line 38)
-
$tpl->assign("userpenname", $userinfo['penname']." ".$nameinfo);
After that, add this:
Open: languages/en.php (Or your language file)
At the end of the file, look for this
-
?>
BEFORE that, add this:
-
// Last Visit Mod
Finally, add {lastlog} to profile.tpl where you want it to appear.
Save, upload, and enjoy!
|
|


One Response to “Last Visit Mod”
January 29th, 2008 at 6:39 pm
I’ve followed the Last Visit mod for eFic 2.x, but the one part that’s not clear to me is where I put “ALTER TABLE `fanfiction_authors` ADD `lastlog` DATETIME NOT NULL.” For now, I’ve placed it in /docs/upgrade-tables-step6.sql right below “ADD `alertson` CHAR( 1 ) DEFAULT ‘0′ NOT NULL,” in the ALTER TABLE ‘fanfiction_authors’ section, but it’s still not working for me :/ I posted in the forums, but since the thread has been in disuse, no one has answered.
Thank you in advance :D