Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
I'd like to see if one of you super geniuses would know how to add a mod to my posts that show when the person last posted under their avatar.

It shows last posted in the CPanel so it keeps track somewhere, can that be harnessed and displayed for all users to see when they post.

Sponsored Links
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Code

}

if ($lastpost) {
$lastpost = $html->convert_time($lastpost,$user['USER_TIME_OFFSET'], $user['USER_TIME_FORMAT']);
}

Is there somewhere to enter this?

Joined: Jan 2000
Posts: 5,833
Likes: 20
UBBDev / UBBWiki Owner
Time Lord
UBBDev / UBBWiki Owner
Time Lord
Joined: Jan 2000
Posts: 5,833
Likes: 20
I'd immagine so


UBB.Dev - Putting Dev into UBB.threads
Company: VNC Web Services - UBB.threads Scripts and Scripting, Install and Upgrade Services, Site and Server Maintenance.
Forums: A Gardeners Forum, Scouters World, and UGN Security
UBB.Threads: My UBB Themes, My UBB Scripts
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Well I know where I got it from, whats the right way to work the code into the postside so it doesn't wig everything out. Or is it just that straight code.

Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
In /scripts/showflat.inc.php you should add that code, or something like it that would really work, put it in the posts show thingy array, and show that thingy in the smarty template.

As easy as counting 1,2,3 smile

Sponsored Links
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Your speaking cow to a bird, huh? Heh *twitch*

So I can slip
Code

$query = "
SELECT NOTE_TEXT
FROM {$config['TABLE_PREFIX']}USER_NOTES
WHERE USER_ID = ?
";
$sth = $dbh -> do_placeholder_query($query,array($uid),__LINE__,__FILE__);
list($notes) = $dbh -> fetch_array($sth);
// Setup the default values

if ($lastpost) {
$lastpost = $html->convert_time($lastpost,$user['USER_TIME_OFFSET'], $user['USER_TIME_FORMAT']);
}

Somewhere near
Code

}
}
$postrow[$i]['Username'] = $Username;
$postrow[$i]['Title'] = $Title;
$postrow[$i]['CustomTitle'] = $CustomTitle;

if ( ($config['SHOW_POSTER_IP'] == 1) && $IP) {
$postrow[$i]['IP'] = "($IP)";
}

elseif ( ($config['SHOW_POSTER_IP'] == 2) && ( ($user['USER_MEMBERSHIP_LEVEL'] == "Administrator") || ($ismod=='yes') ) && ($IP) ) {
$postrow[$i]['IP'] = "($IP)";

On showflat.inc.php

...

But the rest of what your saying.. erg?

Last edited by AshtarRose; 10/06/2007 3:26 PM.
Joined: Nov 2003
Posts: 482
Enthusiast
Enthusiast
Offline
Joined: Nov 2003
Posts: 482
um that's easy peasy..

if Yarp™ hasn't done it by later on today i can whip it up for you..

should be a 5 minute dealio

Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
In my head it seems like it should be super easy to do, I want people to know when someone made their last post and to me it almost seems like plugging code into a new spot. But its still intimidating.

Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
I'll start the frying pan to cook things up smile

Where do you want it? Right under the avatar?

Last edited by blaaskaak; 10/06/2007 5:21 PM.
Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
http://www.riddledindarkness.com/hp...flat&Number=537264&Main=17197#Post537264

I want to be able to slip it under Posts:

Posts:
Last Posted:


he board revolves around activity, if their posting somewhere on the board then I'd like it to be known their active even if they've not responded to a thread they've started.

Sponsored Links
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
I just had a looksy, and it is pretty easy to do, but it will put an extra serverload to your forum because we have to join in a 4th table (ubbt_USER_DATA) to the main query of showflat.inc.php which will make the query run longer. How much the impact really is, I don't know smile

It's not just showing some field that's there anyway but not shown.

Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Registered: 08/29/07
Posts: 2
01/01/70 01:00 AM

bleh... fix fix fix...

edit: fixed smile

Last edited by blaaskaak; 10/06/2007 6:15 PM.
Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Done! SD can take the time to finished up sunday evenings zip smile

in /scripts/showflat.inc.php there's a line with
Code
	// This is the main query that will be used

Replace the beautifull query below it with this one:
Code
	$query = "
SELECT t1.POST_ID,t2.USER_DISPLAY_NAME,t1.POST_POSTED_TIME,t1.POST_POSTER_IP,t1.POST_SUBJECT,t1.POST_BODY,t1.POST_IS_APPROVED,t3.USER_AVATAR,t3.USER_TITLE,t3.USER_CUSTOM_TITLE,t3.USER_NAME_COLOR,t1.POST_ICON,t1.POST_HAS_POLL,t1.POST_HAS_FILE,t1.POST_PARENT_ID,t2.USER_MEMBERSHIP_LEVEL,t3.USER_SIGNATURE,t1.POST_LAST_EDITED_TIME,t1.POST_LAST_EDIT_REASON,t1.POST_LAST_EDITED_BY,t3.USER_LOCATION,t3.USER_TOTAL_POSTS,t2.USER_REGISTERED_ON,t3.USER_RATING,t3.USER_AVATAR_WIDTH,t3.USER_AVATAR_HEIGHT,t2.USER_ID,t1.POST_PARENT_USER_ID,t3.USER_BIRTHDAY,t3.USER_PUBLIC_BIRTHDAY,t1.POST_ADD_SIGNATURE,t3.USER_ACCEPT_PM,t3.USER_HOMEPAGE,t3.USER_VISIBLE_ONLINE_STATUS,t3.USER_MOOD,t1.POST_POSTER_NAME,t4.USER_LAST_POST_TIME
FROM {$config['TABLE_PREFIX']}POSTS AS t1,
{$config['TABLE_PREFIX']}USERS AS t2,
{$config['TABLE_PREFIX']}USER_PROFILE as t3,
{$config['TABLE_PREFIX']}USER_DATA as t4
WHERE t1.PREG_QUERY_FIELD = ?
AND t1.USER_ID = t2.USER_ID
AND t1.USER_ID = t3.USER_ID
AND t1.USER_ID = t4.USER_ID
$Viewable
ORDER BY POST_ID
";

Find:
Code
		list ($Number,$Username,$Posted,$IP,$Subject,$Body,$Approved,$Picture,$Title,$CustomTitle,$Color,$Icon,$Poll,$Files,$ParentPost,$PostStatus,$Signature,$LastEdit,$LastEditReason,$LastEditBy,$Location,$TotalPosts,$Registered,$stars,$picwidth,$picheight,$usernum,$ParentUser,$bday,$showbday,$addsig,$accept_pm,$homepage,$visible,$mood,$postername) = $results[$i];

Replace with
Code

list ($Number,$Username,$Posted,$IP,$Subject,$Body,$Approved,$Picture,$Title,$CustomTitle,$Color,$Icon,$Poll,$Files,$ParentPost,$PostStatus,$Signature,$LastEdit,$LastEditReason,$LastEditBy,$Location,$TotalPosts,$Registered,$stars,$picwidth,$picheight,$usernum,$ParentUser,$bday,$showbday,$addsig,$accept_pm,$homepage,$visible,$mood,$postername,$userlastpost) = $results[$i];



Find
Code
		$PrintLastEdit = "";

Add below:
Code

if ($userlastpost) {
$userlastpost = $html -> convert_time($userlastpost,$useroffset,$user['USER_TIME_FORMAT']);
}
$postrow[$i]['userlastpost'] = "Last post: $userlastpost";

in /templates/default/post_side.tpl
find
Code
{$postrow[post].TotalPosts}

add below:
Code
{if $postrow[post].userlastpost}
<br />
{$postrow[post].userlastpost}
{/if}

Replace #1 adjusts the query so that the lastpost time is available in the query.

Replace #2 makes sure the output of that new field is available for the script

Replace #3 Formats the data and makes it available for the template.

Replace #4 just adds it to the template.

I am pretty sure you can do what you need to do for post_top.

Enjoy! And if there something wrong, let me know. I probably spend only 10 seconds after I thought it was finished.

Joined: Sep 2005
Posts: 136
Journeyman
Journeyman
Offline
Joined: Sep 2005
Posts: 136
Hack Working! Kick Ass! There is no excuse to abandon a thread if someone can clearly see wether you are active or not.

Joined: Feb 2007
Posts: 329
Yarp™
Yarp™
Offline
Joined: Feb 2007
Posts: 329
Heck, there's even a last visit field where the actual last time of visit is kept in if you want to take it further.

If you would want that, change in replace #1 t4.USER_LAST_POST_TIME by t4.USER_LAST_VISIT_TIME

And change the text ofcourse.


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
isaac
isaac
California
Posts: 1,157
Joined: July 2001
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
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)