This adds a field at the bottom of a user's profile that shows when they were last logged in/online. Very useful
Also updated it to change when someone registered, to when they were last online, in the Userlist
Files Modified:
showprofile.php
templates/default/showprofile.tmpl
---
showmembers.php
templates/default/showmembers.tmpl
--To add it in their profile...
In showprofile.php Find:
<br />$date = $html -> convert_time($Registered,$toffset); <br />
Below it, add this: <br />$query = " <br /> SELECT U_Laston <br /> FROM {$config['tbprefix']}Users <br /> WHERE U_Number = '$User' <br /> "; <br /> $sth = $dbh -> do_query($query); <br />list($Laston) = $dbh -> fetch_array($sth); <br />$Laston = $html -> convert_time($Laston,$toffset); <br />
Now, in templates/default/showprofile.tmpl
Find this:
<br /><tr> <br /><td valign="top" class="darktable"> <br />{$ubbt_lang['REGGED_ON']} <br /></td> <br /><td colspan="2"> <br />$date <br /></td> <br /></tr> <br />
Below it, add this: <br /><tr> <br /><td valign="top" class="darktable"> <br />Last Online <br /></td> <br /><td colspan="2"> <br />$Laston <br /></td> <br /></tr> <br />
--To change when a user registered, to when they were last online...
In showmembers.php:
1- Find
$RegedS = "";
Change it to
$Lastons = "";
2- Find
$sortreged = 11;
Change it to
$sortlaston = 11;
3- Find
11 => array(0=>"<img src="{$config['images']}/ascend.gif" border="0" alt="" />", 1=> "U_Registered ASC"),
12 => array(0=>"<img src="{$config['images']}/descend.gif" border="0" alt="" />", 1=> "U_Registered DESC")
Change it to
11 => array(0=>"<img src="{$config['images']}/ascend.gif" border="0" alt="" />", 1=> "U_Laston ASC"),
12 => array(0=>"<img src="{$config['images']}/descend.gif" border="0" alt="" />", 1=> "U_Laston DESC")
4- Find
case 11:
$RegedS = $Sorting['11']['0'];
$sortreged = 12;
break;
case 12:
$RegedS = $Sorting['12']['0'];
$sortreged = 11;
break;
Change to
case 11:
$Lastons = $Sorting['11']['0'];
$sortlaston = 12;
break;
case 12:
$LastonS = $Sorting['12']['0'];
$sortlaston = 11;
break;
5- Find
SELECT U_Username,U_Registered,U_Extra1,U_Homepage,U_TotalPosts,U_Status,U_Number
Change to
SELECT U_Username,U_Laston,U_Extra1,U_Homepage,U_TotalPosts,U_Status,U_Number
6- Find
list ($Username,$Reged,$ICQ,$Home,$Posts,$Status,$Uid) = $dbh -> fetch_array($sth);
Change to
list ($Username,$Laston,$ICQ,$Home,$Posts,$Status,$Uid) = $dbh -> fetch_array($sth);
7- Find
$userrow[$i]['Reged'] = $Reged;
Change to
$userrow[$i]['Laston'] = $Laston;
8- Find
$Reged = $html -> convert_time($Reged,$user['U_TimeOffset']);
Change to
$Laston = $html -> convert_time($Laston,$user['U_TimeOffset']);
Finally, in templates/default/showmembers.tmpl...
<a href="{$config['phpurl']}/showmembers.php?Cat=$Cat&sb=$sortreged&page=$page&like=$like"> <br />{$ubbt_lang['REGGED_ON']} $RegedS
Change to:
<a href="{$config['phpurl']}/showmembers.php?Cat=$Cat&sb=$sortlaston&page=$page&like=$like"> <br />Last Online $LastonS
anddd...
Find:
<td class="{$userrow[$i]['color']}"> <br />{$userrow[$i]['Reged']}
Change to:
<td class="{$userrow[$i]['color']}"> <br />{$userrow[$i]['Laston']}
...and that *should* do it!