============================================================================================================================
Modification Title: Last Post and Last Visit in Member List

Version: 1.0

Mod Author: WormHole

Description:
This modification will provide members last post and last visit date in the members list.

Supported Version: XMB 1.9.5 SP1

Installation Note:
Before adding this modification to your forum, you should back up all files related to this modification.

License Note:
This modification is released under the GPL License v3. A copy is provided with this software package.

Author Note:
For security purposes, Please Check: http://www.xmbgarage.com for the latest version of this mod.
Downloading this mod from other sites could cause malicious code to enter into your XMB Forum software.
As such, XMB Garage will not offer support for modifications not offered from our website.
============================================================================================================================
=======
Step 1:
=======
==================
Edit English.lang.php
==================
=================
Add To End Of File:
=================

// Last Post and Last Visit in Member List Mod Begin
$lang['latestactivity'] = "Latest Activity";
$lang['lastpostdate'] = "Last Post";
$lang['lastpost'] = "Last Post:&nbsp;";
$lang['lastvisit'] = "Last Visit";
$lang['lastvisittoday'] = "Today";
$lang['lastvisityesterday'] = "Yesterday";
// Last Post and Last Visit in Member List Mod End

============================================================================================================================
=======
Step 2:
=======
===============
Edit File: misc.php
===============
==========
Find Code:
==========

                $member['regdate'] = gmdate($dateformat, $member['regdate'] + $adjTime );

===============
Add Code Above:
===============

                // Last Post and Last Visit in Member List Mod Begin
                // Last Visit In Member List Begin
                if ($member['lastvisit'] == 0) {
                    $member['lastvisit'] = $member['regdate'];
                }
                $member['lastvisit'] = gmdate("n/j/y",$member['lastvisit'] + ($timeoffset * 3600));
                if ($member['lastvisit'] == gmdate("n/j/y",time()))
                    $member['lastvisit'] = "$lang[lastvisittoday]";
                elseif ($member['lastvisit'] == gmdate("n/j/y",time() - (60*60*24)))
                    $member['lastvisit'] = "$lang[lastvisityesterday]";
                // Last Visit In Member List End
                // Last Post in Member List Begin
                $lastpost = '';
                if ($member['postnum'] > 0) {
                $lp = $db->query("SELECT * FROM $table_posts WHERE author='$member[username]' ORDER BY dateline DESC LIMIT 0, 1");
                while($lpost = $db->fetch_array($lp)) {
                    $lastpostdate = gmdate("$dateformat",$lpost['dateline'] + ($timeoffset * 3600));
                    $lastposttime = gmdate("$timecode",$lpost['dateline'] + ($timeoffset * 3600));
                    $lastmemberposttext = "$lastpostdate $lang[textat] $lastposttime";
                    // $lt = $db->query("SELECT tid FROM $table_posts WHERE author='$member[username]' ORDER BY dateline DESC LIMIT 0, 1");
                    $location_name = '';
                    $lthread = $lpost['tid'];
                    $ltidquery = $db->query("SELECT subject FROM $table_threads WHERE tid='$lthread'");
                        if ($db->num_rows($ltidquery) != 0) {
                            $location_name = "<a href='viewthread.php?tid=$lpost[tid]&pid=$lpost[pid]#pid$lpost[pid]'>".stripslashes($db->result($ltidquery,0))."</a>";
                        }
                    }
                    $lastpost .= "$lastmemberposttext<br /><b>$lang[textsubject]</b> $location_name";
                }
                else
                $lastpost = "$lang[textnever]";
                // Last Post in Member List End
                // Last Post and Last Visit in Member List Mod End
                if ($member['lastvisit'] == gmdate("n/j/y",time()))
                    $member['lastvisit'] = "$lang[lastvisittoday]";
                elseif ($member['lastvisit'] == gmdate("n/j/y",time() - (60*60*24)))
                    $member['lastvisit'] = "$lang[lastvisityesterday]";
                // Last Visit In Member List End
                // Last Post in Member List Begin
                $lastpost = '';
                if ($member['postnum'] > 0) {
                $lp = $db->query("SELECT * FROM $table_posts WHERE author='$member[username]' ORDER BY dateline DESC LIMIT 0, 1");
                while($lpost = $db->fetch_array($lp)) {
                    $lastpostdate = gmdate("$dateformat",$lpost['dateline'] + ($timeoffset * 3600));
                    $lastposttime = gmdate("$timecode",$lpost['dateline'] + ($timeoffset * 3600));
                    $lastmemberposttext = "$lastpostdate $lang[textat] $lastposttime";
                    $location_name = '';
                    $lthread = $lpost['tid'];
                    $ltidquery = $db->query("SELECT subject FROM $table_threads WHERE tid='$lthread'");
                        if ($db->num_rows($ltidquery) != 0) {
                            $location_name = "<a href='viewthread.php?tid=$lpost[tid]&pid=$lpost[pid]#pid$lpost[pid]'>".stripslashes($db->result($ltidquery,0))."</a>";
                        }
                    }
                    $lastpost .= "$lastmemberposttext<br /><b>$lang[textsubject]</b> $location_name";
                }
                else
                $lastpost = "$lang[textnever]";
                // Last Post in Member List End
                // Last Post and Last Visit in Member List Mod End

============================================================================================================================
=======
Step 3:
=======
===============================
Go To Administration Panel --> Templates
===============================
===================================
Edit Templates: misc_mlist and misc_mlist_admin
===================================
==========
Find Code:
==========

<td class="header" align="center" width="5%">$lang[textposts]</td>

===============
Add Code Below:
===============

<td class="header" align="center" width="15%">$lang[lastpostdate]</td>
<td class="header" align="center" width="4%">$lang[lastvisit]</td>

============================================================================================================================
=======
Step 4:
=======
===============================
Go To Administration Panel --> Templates
===============================
===============================
Edit Template: template misc_mlist_row
===============================
==========
Find Code:
==========

<td bgcolor="$altbg2" class="ctrtablerow">$member[postnum]</td>

===============
Add Code Below:
===============

<td bgcolor="$altbg1" class="ctrtablerow">$lastpost</td>
<td bgcolor="$altbg2" class="ctrtablerow">$member[lastvisit]</td>

============================================================================================================================
=======
Step 5:
=======
===============================
Go To Administration Panel --> Templates
===============================
==============================================================
Edit Templates: misc_mlist_multipage, misc_mlist_results_none and misc_mlist_separator
==============================================================
==========
Find Code:
==========

colspan="8"

================
Replace Code With:
================

colspan="10"

============================================================================================================================
Enjoy!