• Welcome to Simple Machines Community Forum. Please login or sign up.

Is it possible to execute this code in display.template.php

Started by Biology Forums, October 26, 2014, 02:26:38 PM

Previous topic - Next topic

Biology Forums

For SMF 1,

If the last poster ID of this topic is equal to the ID of the logged in member
Echo'';


This is going somewhere in display.template.php.

Was wondering if SMF keeps information about the poster of the last message added. If possible, could someone write it out for me.

margarett

You aren't making much sense :P

The code you asked is perfectly possible to be made in 2.0
But then you mention details about last message added.

Can you rephrase to specify what you need? ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Biology Forums

If the member that posted last in this topic equals the ID of the member who's logged in.

margarett

I'm sorry, it is clear, I misread.

I'm not sure and I'm not on the computer right now, but you can print_r $topic (or is it $context['topic'] ?) and you can see the current information. When I get to the computer I can check it for you ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Biology Forums


Pipke

ok here you go.. in Display.template.php
Find:

// Show information about the poster of this message.


Replace with:

// Show information about the poster of this message.
$lastid = $message['member']['id'];


next do

Find:

echo '<br />';


Replace with:

echo '<br />';

if ($context['user']['id'] == $lastid)
echo'<p><b>The last poster in this topic is the person who is logged in now!</b></p>';


save, upload and your good to go, before changes make backup of the file.
"If something is wrong, fix it if you can. But train yourself not to worry. Worry never fixes anything."
My Mods for SMF:
Avatars Display Integration
Avatars on Board and/or MessageIndex
Recent Forum Topics on Boardindex
Relative Time Formats

margarett

That's not entirely true... That only works if the last post is on the page currently being viewed.

Looking at it now, there is no such information being extracted by default. You get the ID of the last post but not its author.
If you need to do that, an extra query is required ;)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

Arantor

And you couldn't add, say, t.ID_MEMBER_UPDATED to the query early in Display.php where it already fetches t.id_MEMBER_STARTED and then check $topicinfo['ID_MEMBER_UPDATED']

We need an innocent-whistle smiley.
No good deed goes unpunished
All helpful urges should be circumvented

Biology Forums

Thanks fellas, I think I'll try what Arantor suggested.

Advertisement: