Modification Title: Last Post and Last Visit in Members List v1.0

Modification Author: WormHole

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

Supported Version: XMB 1.9.8 SP3

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. 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 modification.
Downloading this modification 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 at our website.
==============================================================================================================
=======
Step 1.
=======
=================
Edit English.lang.php
=================
========================
Add To End Of File Above ?>
========================

// 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 misc.php
============
======
Find:
======

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

===========
Add 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 ".X_PREFIX."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 ".X_PREFIX."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 ".X_PREFIX."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 ".X_PREFIX."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.
=======
===================================
Edit Templates: misc_mlist and misc_mlist_admin
===================================
======
Find:
======

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

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

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

=============
Find (2 Times):
=============

colspan="7"

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

colspan="9"

==============================================================================================================
=======
Step 4.
=======
=======================
Edit Template misc_mlist_row
=======================
======
Find:
======

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

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

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

==============================================================================================================
=======
Step 5.
=======
==============================================================
Edit Templates: misc_mlist_multipage, misc_mlist_results_none and misc_mlist_separator
==============================================================
======
Find:
======

colspan="7"

============
Replace with:
============

colspan="9"

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