php forum
php mysql forum
php mysql smarty
 
Topic Options
#315950 - 10/05/07 07:46 PM Last Posted Viewable on ShowSide/Show Top
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
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.
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315951 - 10/05/07 07:57 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
Code:
}

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


Is there somewhere to enter this?
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315952 - 10/06/07 01:22 AM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
Gizmo Offline

Wizard

Registered: 01/10/00
Posts: 5354
Loc: Portland, OR, USA
I'd immagine so
_________________________
UBB.Dev - Where you too can render your UBB install completely useless...
UGN Security, Elite Web Gamers & VNC Web Design & Development President
UBB.Threads: My UBBSkins, UBB.Sitemaps

Top
#315953 - 10/06/07 10:51 AM Re: Last Posted Viewable on ShowSide/Show Top [Re: Gizmo]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
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.
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315954 - 10/06/07 02:40 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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
_________________________

Top
#315955 - 10/06/07 03:17 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
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?


Edited by AshtarRose (10/06/07 03:26 PM)
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315956 - 10/06/07 05:04 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
sirdude Offline
Enthusiast

Registered: 11/08/03
Posts: 490
Loc: SoCal
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
_________________________

Top
#315957 - 10/06/07 05:11 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: sirdude]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
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.
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315958 - 10/06/07 05:21 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
I'll start the frying pan to cook things up smile

Where do you want it? Right under the avatar?


Edited by blaaskaak (10/06/07 05:21 PM)
_________________________

Top
#315959 - 10/06/07 05:29 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
http://www.riddledindarkness.com/hprpg/u...7197#Post537264

I want to be able to slip it under Posts:

Posts:
Last Posted:
<date>

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.
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315960 - 10/06/07 05:31 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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.
_________________________

Top
#315961 - 10/06/07 06:06 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
Registered: 08/29/07
Posts: 2
01/01/70 01:00 AM

bleh... fix fix fix...

edit: fixed smile


Edited by blaaskaak (10/06/07 06:15 PM)
_________________________

Top
#315962 - 10/06/07 06:25 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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.
_________________________

Top
#315963 - 10/06/07 09:05 PM Re: Last Posted Viewable on ShowSide/Show Top [Re: blaaskaak]
AshtarRose Offline
Journeyman

Registered: 09/22/05
Posts: 137
Loc: Columbus, OH
Hack Working! Kick Ass! There is no excuse to abandon a thread if someone can clearly see wether you are active or not.
_________________________
http://www.riddledindarkness.com * Yeah I need the Crazy Mods.

Top
#315969 - 10/07/07 03:22 AM Re: Last Posted Viewable on ShowSide/Show Top [Re: AshtarRose]
blaaskaak Offline
Enthusiast

Registered: 02/25/07
Posts: 329
Loc: The Netherlands
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.
_________________________

Top



Moderator:  sirdude 
Latest Posts
[7.2.1] - Naked shoutbox
by bellaonline
05/05/12 05:00 PM
[7.x] Stop Forum Spam Integration v0.4
by bellaonline
05/05/12 03:53 PM
Shout Box

(Views)Popular Topics
Known public proxy servers 1689885
Integrated Index Page (IIP) 5.3.1 555705
Finished-[6.5.2] Games Arcade Deluxe v1.9 501236
Integrated Index Page (IIP) 5.1.1 415112
TLD Bv2.1 Released - Threads Links Directory 396822
[6.0x] Who's Online 4.0.0 [Finished] 389412
Finished-[6.5.1] Integrated Index Page (IIP) 6.5 330423
Q & A 298663
Slash UBB 266936
[6.3.x] [beta] Hit Hack 2.0 227970
Forum Stats
13621 Members
59 Forums
37191 Topics
295716 Posts

Max Online: 686 @ 06/28/07 07:04 AM

 

 

 
fusionbb message board php hacks