Firefox PHP

last post by mod

Posted by WillyPS 
last post by mod
May 22, 2003 04:24PM
This will show the user who made the last post a side of the timestamp:

-In list.tpl (root: templates/yourtemplate/):

Find:

{ROWS->lastpost}

Add:

posted by {ROWS->linked_author}

Final line should look like this:

{ROWS->lastpost} posted by {ROWS->linked_author}


-In list.php (root phorum dir):

Find:

$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"]);

Replace with:

$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"], $rows[$key]["linked_author"]);

That's it. I haven't test it on list_threads.tpl, so if someone does, maybe can post something about it. Hope this like you all!
Re: last post by mod
May 22, 2003 05:11PM
I don't get what the phorum_date has to do with linked_author. Somewhere in the code you have to get that author and this stuff here does not seem to do that.
Re: last post by mod
May 22, 2003 05:44PM
on post-time we already save the last posts-author and userid in the meta-data:
$message["meta"]["recent_post"]["user_id"]=$recent_message["user_id"];
$message["meta"]["recent_post"]["author"]=$recent_message["author"];

its just not output anywhere yet ;-).

Use these fields to build your link.
Re: last post by mod
May 22, 2003 06:58PM
Brian, I try it on my forum and it works just fine:

[lasalabanzas.brain7d.com]

About what Thomas posted, though I'll take a look at that meta-data :)
Re: last post by mod
May 22, 2003 07:01PM
hmm, I see only one poster there. you'll most probably have the first poster shown there. you should try with more users.

or better, just use the meta-data for this, its made for this case :).
Re: last post by mod
May 22, 2003 07:22PM
Ok, I'll try meta-data later and test it ;)
Re: last post by mod
May 22, 2003 10:58PM
Yeah, what you are looking for is in the meta-data.
Re: last post by mod
May 23, 2003 06:54AM
The meta-data shows me the thread author and not the last post author:

$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"]);
$rows[$key]["lastpostby"] = $row["author"];

Any hint on how to?
Re: last post by mod
May 23, 2003 10:03AM
where do you get this idea from?
Re: last post by mod
May 23, 2003 03:51PM
Can you gimme a tip about how to acomplish this task?
Re: last post by mod
May 23, 2003 09:51PM
To get the last poster to thread read

[recent_post][author] as Thomas suggests.

if yo modify your first example like this:

$rows[$key]["lastpost"] = phorum_date($PHORUM["short_date"], $row["modifystamp"])." by ".$rows[$key]["linked_author"];


Panu
Re: last post by mod
May 23, 2003 09:53PM
... You might have easy solution also.

Panu

PS. Message editing seems to be switched off?
Re: last post by mod
May 23, 2003 10:03PM
After looking into this I think this should be a perfect place for a mod.

The hook is already in place, easy to copy template logic from for example vievcount mod etc.

Panu
Re: last post by mod
May 23, 2003 10:43PM
Ok I made a mod that shows the last poster name after the timestamp (or whatever place you want to put the tag...).

Let me know if you want it.

Thomas & Brian: I made the "by" a localized string - I don't know if thats something that should be in the lang-file or should it be on the mod?

Another thing is that language structures are different and "23.5.03 22:25 by Panu" cant be translated to for example Finnish just like that. So maybe webmasters are responsible to figure that out by themselves.

1 line addition to list.tpl (maybe threaded doesn't need this anyway?):

{IF LAST_POSTED_BY}{LANG->BY} {ROWS->last_post_by}{/IF}

I would still like to add cropping of the author if it's too long etc. But it works as planned here.

Of course this could have been done without a mod even but it's easier to control if someone want's to use it or not.

Panu
Re: last post by mod
May 24, 2003 07:47AM
Ok, got it wokin now. Goes like this:

In list.tpl (root: templates/yourtemplate/):

-Find:

{ROWS->lastpost}

-Add a side or below:

posted by {ROWS->lastpostby}

-Final line should look like this:

{ROWS->lastpost} posted by {ROWS->linked_author}


Then, in list.php (root phorum dir):

-Find:

$rows[$key]["url"] = phorum_get_url(PHORUM_READ_URL, $row["thread"]);

Add below:

if ($row["user_id"]){
$url = phorum_get_url(PHORUM_PROFILE_URL, $row["meta"]["recent_post"]["user_id"]);
$row["lastpostby"] = $row["meta"]["recent_post"]["author"];
$rows[$key]["lastpostby"] = "<a href=\"$url\">$row[lastpostby]</a>";
}
else{
$rows[$key]["lastpostby"] = $row["meta"]["recent_post"]["author"];
}

It should work smoothly (I hope) :) You can check it out at (right column, below timestamp):

[lasalabanzas.brain7d.com]

Re: last post by mod
May 24, 2003 07:50AM
Wanna make a correction (couldn't edit the post :( ):

In the list.tpl step, where it reads:

"-Final line should look like this:

{ROWS->lastpost} posted by {ROWS->linked_author}"

Line: {ROWS->lastpost} posted by {ROWS->linked_author}

Should be: {ROWS->lastpost} posted by {ROWS->lastpostby}

Ok? :)
Re: last post by mod
May 24, 2003 07:55AM
Another correction:

In list.php step:

Line: if ($row["user_id"]){

Should be: if ($row["meta"]["recent_post"]["user_id"]){

Though that's it...
Re: last post by mod
May 24, 2003 07:56AM
[dev.phorum.org]

yeah, I got it going in the Test Forum, check it out. Thoughts? I actually do use this when on boards that have it so I am all for leaving it in.

Thomas, look at it as a moderator. I had to move the moderation links back under the subject to keep the height under contol. Its not that bad.
Re: last post by mod
May 24, 2003 08:21AM
Jees... the board parsed some html of my code and doesn't showed up as text. Anyway, in my last post, on the list.php step, where:

$rows[$key]["lastpostby"] = "$row[lastpostby]";

Should be: $rows[$key]["lastpostby"] = "&lt;a href=\"$url\"&gt;$row[lastpostby]&lt;/a&gt;";
Re: last post by mod
May 24, 2003 08:27AM
!!!!!!!!!!!!! #&%@ :P

In that last line:

&lt; stands for <
&gt; stand for >

When copying, replace, please.

BTW, Brian, though this mod should considered for inclution in phorum :) It could be extended a little bit, because, if webmaster allows forum guest to post and this forum guest supply an email, the name of the guest when printed on the last-post-by, could be linked with a href:mailto link.
Re: last post by mod
May 24, 2003 09:37AM
Willy, Brian already included it in the test-forum so I think it will be in cvs already now or at least shortly :).

Brian, I don't have permissions in the demo-forum, the user-accounts were taken to the support-forum. I registered there now again, maybe you could just make me a mod again.
Re: last post by mod
May 24, 2003 10:41AM
Is this a mod? Does it require changes to anywhere else except the one line in template?

Well it doesn't really matter if the code is already changed in Phorums script.

Only difference to my system functionvise is that the authorname is on the same line with the date and time (of course it can be configured in the mod to have linebreak after, before etc).

Panu

Re: last post by mod
May 24, 2003 08:54PM
What files where changed? list.php says Rev 1.41 and Age 4 weeks.
Re: last post by mod
May 24, 2003 09:36PM
its not all checked in yet as far as I see.
hey keep in mind, its weekend.
Re: last post by mod
May 25, 2003 06:17AM
It is now checked in. It is not a mod. It is just part of the code. I think it is a common enough and useful enough feature that it can go in the main code. Plus, it does not cause any performance issues as the data is already being pulled.
Re: last post by mod
May 25, 2003 05:50PM
This is a good feature, only not desired side feature is that it's on two lines. (and translation is little tricky)

I have already compacted the list display to 25 px per row to maximise rows/cm. This feature is almost doubling the rowheight.

I can modify it ofcourse.

Panu
Re: last post by mod
May 25, 2003 06:36PM
thats pure templating. you can still change your templates to your liking.
Sorry, only registered users may post in this forum.

Click here to login