News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Disable quote on last message on each topic

Started by sinnerman, November 27, 2014, 07:43:37 PM

Previous topic - Next topic

sinnerman

Hi!

I'm trying to do a little customization with what the title says. I'm running a 2.0.9 SMF forum.
In more details. I want to stop people from quoting the last post in every thread/topic.
So i think that if i just hide or change the behavior of the "quote" button only on the last message i should have achieved my goal.

I know it sounds a little trivial but it's very common in the forum i'm running to see a quote of the right above post which is kind of annoying.

I can probably do everything except one part. How do i isolate the last message on each topic (in php)?
Though if you think you're up to it i won't say no to complete instruction. But i seem to be stuck from the very first step.

Thank you very much for your time and effort.  :)

Antechinus

Quote from: sinnerman on November 27, 2014, 07:43:37 PM
Hi!

I'm trying to do a little customization with what the title says. I'm running a 2.0.9 SMF forum.
In more details. I want to stop people from quoting the last post in every thread/topic.
So i think that if i just hide or change the behavior of the "quote" button only on the last message i should have achieved my goal.

I know it sounds a little trivial but it's very common in the forum i'm running to see a quote of the right above post which is kind of annoying.

I can probably do everything except one part. How do i isolate the last message on each topic (in php)?
Though if you think you're up to it i won't say no to complete instruction. But i seem to be stuck from the very first step.

Thank you very much for your time and effort.  :)

Yeah it is annoying. Drives me bonkers. :D

I did the same thing on a site I used to run. There may already be a mod for it. Have you checked the mod site yet?

If there's no mod available, I'll dig out the code. I have the files somewhere.

Antechinus

Ok, so I looked, and couldn't find a mod. Here's the code. Since I'm posting the code, someone will probably know where a mod is now. You get that. :P

You need to add a bit of custom shenanigans in Sources/Display.php first, otherwise the templates edits won't work.

Find:
if ($smcFunc['db_num_rows']($request) == 0)
fatal_lang_error('not_a_topic', false);
$topicinfo = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);


Add a line to the end of that lot:
if ($smcFunc['db_num_rows']($request) == 0)
fatal_lang_error('not_a_topic', false);
$topicinfo = $smcFunc['db_fetch_assoc']($request);
$smcFunc['db_free_result']($request);
$context['prefix_lastpost'] = $topicinfo['id_last_msg'];



Now you can use the new conditional in your Display.template.php:

// Can they reply? Have they turned on quick reply? Is this not the last post?
if ($context['can_reply'] && ($message['id'] != $context['prefix_lastpost']) && !empty($options['display_quick_reply']))


Etc. :)

kat

Ha! Can we have that installed, here? ;)

Drives me mental, too, that...

kat

Quote from: K@ on November 28, 2014, 08:39:46 AM
Ha! Can we have that installed, here? ;)

Drives me mental, too, that...

Thought I'd do it, before someone else does... ;)

sinnerman

I'm really glad we're not the only forum this happens.
Thank you very much for the almost complete mod..it should be fairly simple from now on..

I ll try it tomorrow cause i'm in a hurry now but i'm sure it will do the trick.
thanks again!

Antechinus

I haven't tested on 2.0.x, but it should work.

sinnerman

worked just fine on 2.0.9!

marked as solved. Thank you very much.

Advertisement: