Simple Machines Community Forum

SMF Support => SMF 2.0.x Support => Topic started by: Black Tiger on March 07, 2014, 12:12:01 PM

Title: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 12:12:01 PM
I would like to adjust my lastpost piece so the thread title is more visible and the "posted by" is just replace with "by", because thread title is more important then the user who posted it.:)

So more like in vbulletin, see the attached screenshot.

Can anybody explain me how to do this. I'm not good at css, so if possible with a "find this" and "replace with this" kind of reply.:)
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 12:36:40 PM
The text string is just a change in a language file (index.english.php)

What do you want to do to the post subject? Bold?
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 03:19:46 PM
The text is not the problem. I want the last thread title more fully.
Now it's something like:
QuoteLast message by L.Oosterhoff
in Re: BBC 3 alleen nog als...
Posted on 03-03-2014

And I want it more like my screenshot, so like this:
QuoteBBC3 alleen nog als FTA zender te zien
by L. Oosterhoff
03-03-2014

So thread title on top, and a little more characters of the thread title and in bold.
The below that, only "by" (or in dutch "door") and the username of the poster.
On the 3rd row, only date, but if possible aligned on the right side. Shortly said, exactly like the screenshot.

Important is that the width of the thread name gets a bit more characters then it has now so more of the thread title is viewable.
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 04:01:15 PM
I just found this in the MessageIndex.template.php and changed the lines to this:
if (!empty($board['last_post']['id']))
echo '
<p><strong>', $board['last_post']['link'], '</strong><br />
', $board['last_post']['member']['link'], '<br />
', $board['last_post']['time'],'
</p>';


So I changed the display order. However, i don't see any changes, in spite of the fact that I did a ctrl-F5 and also tried another browser.
Is this the wrong place or do I need to delete the cache from the cache directory?

And how can I put the last post time to the right side?
Title: Re: Last post adjustment vb-like
Post by: Illori on March 07, 2014, 04:10:10 PM
try display.template.php
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 04:18:39 PM
??? There is nothing like that in display.template.php. The only thing I could find with lastpost in it was:
div class="pagelinks floatleft">', $txt['pages'], ': ', $context['page_index'], !empty($modSettings['topbottomEnable']) ? $context['menu_separator'] . ' &nbsp;&nbsp;<a href="#lastPost"><strong>' . $txt['go_down'] . '</strong></a>' : '', '</div>

and this one:
<a id="lastPost"></a>';
I don't see anything of user or date in there, so nothing to change the display order.
Title: Re: Last post adjustment vb-like
Post by: Illori on March 07, 2014, 04:22:31 PM
oh... sorry boardindex.template.php
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 04:36:16 PM
Thank you, that worked.

Now I just need the last 2 things.
1.) Where can i give the last topic title a bit more width so a few more characters of the last post title are displayed?
2.) How can set that onlyl this part:
', $board['last_post']['time'],'
will align to the rigt?
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 06:22:54 PM
1) Subs-BoardIndex.php
$row_board['short_subject'] = shorten_subject($row_board['subject'], 24);
See the 24? Have fun :P

2) Have to check
edit:
Like this:
<div style="text-align:right;">', $txt['on'], ' ', $board['last_post']['time'],'</div>
(you probably want to remove the "on" part)
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 06:44:44 PM
Thank you Margarett, you are great!

About the txt part, can I just also remove the complete txt section so it will be like this (did this also with the other adjustment):
<div style="text-align:right;">', $board['last_post']['time'],'</div>
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 06:46:10 PM
Of course ;)
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 07:15:44 PM
Oh great, it worked, my love-meter for SMF is raising more and more.

Just a last question which I forgot..... Where is the "Re: topictitle", so I can remove the "Re:" part?
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 07:36:30 PM
That's a little bit trickier...

Thing is, in SMF each post has its own subject (so different posts can have different subjects inside same topic, see what I mean?

So, there are basically 2 possibilities:
1 - Adjust the query to retrieve the topic subject (first message, that is...) and show it --> bad idea, would have a very complicated query (2 extra JOINs if I'm thinking straight) repeating itself for each board
2 - Pick that subject, search for "Re:" in the first position and replace it --> str_replace maybe?
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 08:07:26 PM
I understand. Changing subjects by users in a topic works the same as in vBulletin where I just migrated from. In their topics a user can also put a title/subject above his reply. Not that I liked that, don't see a reason to it either, but that's beside the point.:)

But that subject display part works a bit different on SMF then on vBulletin. With vB it's indeed not the last reply or subject shown there, but only the latest (newest) thread title. The user displayed is the same was with SMF the user who made the newest reply to it.
And if a user clicks on that thread title, he will be automatically taken to his last read post in that topic.

I don't quite understand the 2nd solution about the str_replace. Is that something that would make a mod necessary? Something which has to do a "search and replace" in the database every time?
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 08:14:11 PM
Nop, it's just a string comparison, actually... It's probably the best option, actually. Or else we would need to get the first post subject from the topic which the current post belongs to :P

/me got lost in his own thinking ;D
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 07, 2014, 08:30:29 PM
So is that easy to implement somehow? Because I'm a noob with coding.:)
Title: Re: Last post adjustment vb-like
Post by: margarett on March 07, 2014, 08:34:18 PM
Should be. I can give it a look, but not now as I'm off to bed, since my head is already swinging :P

Bump this tomorrow if I (or someone else) don't post something
Title: Re: Last post adjustment vb-like
Post by: Herman's Mixen on March 08, 2014, 08:35:56 AM
Quote from: Black Tiger on March 07, 2014, 07:15:44 PM
Oh great, it worked, my love-meter for SMF is raising more and more.

Just a last question which I forgot..... Where is the "Re: topictitle", so I can remove the "Re:" part?

open /themes/your-theme-name/languages/index.dutch.php or index.english.php
depends which you are using ;)

Code (find) Select
$txt['response_prefix'] = 'Re: ';

Code (change to) Select
$txt['response_prefix'] = '';

Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 08, 2014, 08:58:08 AM
Thank you Herman. It wasn't quite there, but you put me no the right trail.

It was at /Thems/default/languages/index.dutch(-utf8).php or the english version of it.

Unfortunately, removing the "Re: " from both those index files did not fix it. Checked with 2 browsers and did ctrl-F5.
Title: Re: Last post adjustment vb-like
Post by: Herman's Mixen on March 08, 2014, 09:10:39 AM
Your sure you altered the right theme ?
sometimes themes uses their own languages

Sometimes you must push CNTRL+F5 a few times ;)
Title: Re: Last post adjustment vb-like
Post by: Kindred on March 08, 2014, 09:19:01 AM
IIRC, hat you just did will stop it, going forward, however, you will also have to remove it from all saved titles in the database.
Title: Re: Last post adjustment vb-like
Post by: margarett on March 08, 2014, 09:28:11 AM
^^ This. And, this will prevent the "Re:" to be added to new replies. Not sure if this is intended or a good idea...
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 08, 2014, 09:31:49 AM
Yes. It's only in those two files.
I did a string search under linux console and only those 2 files containing the "Re:" came back as result.
It's like this at the moment:
$txt['response_prefix'] = '';
If you want, you can have a look for yourself. My site is in my profile if it correct.

Margarett: I did not see any "re" on new reply's anyway, and I don't mind if they are not there.:)

@Kindred: That will indeed be the cause. I presume there is no simple way to do this? Have to do it manually via phpmyadmin I guess?
Title: Re: Last post adjustment vb-like
Post by: Herman's Mixen on March 08, 2014, 09:32:37 AM
dunno if this wil work for you but you can try it if it won't change it back

open /Sources/Subs-BoardIndex.php
Code (find) Select

censorText($row_board['subject']);


Code (add before) Select

$row_board['subject'] = preg_replace('/^' . preg_quote($txt['response_prefix']) . '/', '', $row_board['subject']);
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 08, 2014, 09:35:40 AM
It won't remove it Herman.
I will change it back. I think your previous solution will work, but only on newer threads, so from this moment on.
Title: Re: Last post adjustment vb-like
Post by: margarett on March 08, 2014, 09:36:34 AM
You need to add a link to redirect your homepage to /forum so that we don't need to copy/past it ;)

Anyway, I still think that this is not a good idea. Overall you want to know when it is a reply or not, just in BoardIndex you want to have this "Re: trimmed. But that's up to you ;)

Quote from: Black Tiger on March 08, 2014, 09:35:40 AM
It won't remove it Herman.
I will change it back. I think your previous solution will work, but only on newer threads, so from this moment on.
You are right ;)
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 08, 2014, 09:45:17 AM
Thank you all for your great help!!
Title: Re: Last post adjustment vb-like
Post by: margarett on March 08, 2014, 09:49:08 AM
Did Herman's code work?
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 08, 2014, 02:59:43 PM
Yep it worked. As soon as a new reply is posted, the "Re:" is gone.;)
Title: Re: Last post adjustment vb-like
Post by: Black Tiger on March 09, 2014, 08:18:59 PM
Little correction for future references. Herman's code was not needed. It was enough to remove the "Re: " part in the index.english.php (or other language) file.