Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
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:
Code
 <br />$date = $html -> convert_time($Registered,$toffset); <br />


Below it, add this:
Code
 <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:
Code
 <br /><tr> <br /><td valign="top" class="darktable"> <br />{$ubbt_lang['REGGED_ON']} <br /></td> <br /><td colspan="2"> <br />$date &nbsp; <br /></td> <br /></tr> <br /> 


Below it, add this:
Code
 <br /><tr> <br /><td valign="top" class="darktable"> <br />Last Online <br /></td> <br /><td colspan="2"> <br />$Laston &nbsp; <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...

Code
 <a href="{$config['phpurl']}/showmembers.php?Cat=$Cat&amp;sb=$sortreged&amp;page=$page&amp;like=$like"> <br />{$ubbt_lang['REGGED_ON']} $RegedS 

Change to:
Code
 <a href="{$config['phpurl']}/showmembers.php?Cat=$Cat&amp;sb=$sortlaston&amp;page=$page&amp;like=$like"> <br />Last Online $LastonS 


anddd...

Find:
Code
 <td class="{$userrow[$i]['color']}"> <br />{$userrow[$i]['Reged']} 

Change to:
Code
 <td class="{$userrow[$i]['color']}"> <br />{$userrow[$i]['Laston']} 


...and that *should* do it!



Last edited by cstaber; 02/28/2003 5:03 PM.
Sponsored Links
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
great idea... Gonna wait to see if this is a independent hack before installing. Good job on this.

Joined: Jun 2002
Posts: 160
Member
Member
Offline
Joined: Jun 2002
Posts: 160
[]Smilesforu said:
great idea... Gonna wait to see if this is a independent hack before installing. Good job on this. [/]
I just installed this on the HP site and it seems to work, and we're NOT running IIP there. Looks like it's a functional independant hack.

Joined: Jun 2001
Posts: 3,273
That 70's Guy
That 70's Guy
Offline
Joined: Jun 2001
Posts: 3,273
Yes the field U_Laston is a standard .threads field. It's not updated as often as IIP's additional field and therefore not as accurate.

Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
Yeah, it could be changed to last logged in? Seems pretty accurate on my board...was going for the least editing/without having to make a whole new field/script...but as Dave says, IIP Is great

Sponsored Links
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Works great ... thanks

Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
is there some way to replace the registrated on in user list vith this ???

would be nicer to see when a user was last on, instead ;O)

thomas

Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
I've got it...now lemme see if I can catch everything I changed, there is alot lol

Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
Okay, updated the main post for this additional mod

Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
I am missing the benefit on this last add on. .. Wouldn't their last post show when they last on or does this do it in a member search? Thanks

Sponsored Links
Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
If your forum has a userlist enabled...and you clicj on user list (like here) the far right colum that says "date registered" is changed to when they were last online...so you can sort your entire userlist by who was last online..

#236981 02/27/2003 7:03 PM
Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
When we change
$toffset to $timeoffset
and
U_Number to U_Username

it will be work, and work on my forum

Dawg_dup1 #236982 02/27/2003 7:26 PM
Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
oh for an older version of threads you mean?

#236983 02/27/2003 7:49 PM
Joined: Jan 2003
Posts: 338
Enthusiast
Enthusiast
Offline
Joined: Jan 2003
Posts: 338
Yes... because I use ubb 6.1.1

Dawg_dup1 #236984 02/28/2003 3:56 AM
Joined: Jan 2002
Posts: 674
Junior Member
Junior Member
Offline
Joined: Jan 2002
Posts: 674
Ok I see the benefit... could we add a ip to this list for the admins... I have occasional trouble in the chat and this would identify who it was instantly.

Joined: Apr 2001
Posts: 186
Member
Member
Offline
Joined: Apr 2001
Posts: 186
error

i get this when i do that

[]http://www.4701.dk/online.jpg[/]

Joined: Aug 2002
Posts: 109
Journeyman
Journeyman
Offline
Joined: Aug 2002
Posts: 109
ahhh I missed a step, sorry about that...I just started hacking away and wasn't documenting what I was doing...then tried going back and finding all my changes lol
Here...
In showmembers.php Find:
$Reged = $html -> convert_time($Reged,$user['U_TimeOffset']);

Change to

$Laston = $html -> convert_time($Laston,$user['U_TimeOffset']);

and that should do it, I've updated the original post


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)