Page 1 of 1

[DEV] No quote last post

Posted: Thu Feb 07, 2019 7:19 pm
by tojag
Extension Name: Tojag - No quote last post
Author: tojag

Description: It hide a 'quote' button, if a post is the last post in a topic.
Extension Version: [DEV] 1.0.0-dev
Requirements: phpBB 3.2.2 ->

Notes:
This is my first very simple extension. It is based on the skeleton extension.

Features:
  • Hide a 'quote' button, if a post is the last post in a topic.
Installation:
  • Download the latest release and unzip it.
  • Upload the unzipped files to [board root]/ext/tojag/nqlp and enable it in the ACP
GitHub Repository: https://github.com/gz73/no-quote-last-post

Extension Download:https://github.com/gz73/no-quote-last-p ... e/nqlp.zip

Re: [DEV] No quote last post

Posted: Thu Feb 07, 2019 7:20 pm
by tojag
This is my first very simple extension. It is based on the skeleton extension.
If someone want to correct something in my code, please go ahead :)
Regards

Re: [DEV] No quote last post

Posted: Thu Feb 07, 2019 7:47 pm
by warmweer
Just a question (actually 2), no criticism but genuine curiosity
  1. I can't find a discussion about this. What's the reason for not being allowed to quote the last post?
  2. If someone copies the last post into a [quote] [/quote], is the quote removed when submitting (or previewing)?

Re: [DEV] No quote last post

Posted: Thu Feb 07, 2019 8:05 pm
by tojag
I was inspired by this https://www.phpbb.com/customise/db/exte ... ast_post_2
But my extension does not interfere with style file.
If someone copies the last post into a [quote] [/quote] or use quote button from topic review (under post editor) extension does not effect. Why is this extension? Because instead of clicking "Reply" users click "quote", and this is often not welcome on many forums, if the previous post is quoted. Of course, if someone deliberately uses a quote with an already open post editor, the extension will not affect, but this is good.

Re: [DEV] No quote last post

Posted: Fri Feb 08, 2019 8:35 am
by warmweer
tojag wrote:
Thu Feb 07, 2019 8:05 pm
I was inspired by this https://www.phpbb.com/customise/db/exte ... ast_post_2
Ah, ok that explains it, I only searched in 3.2 forums

Re: [DEV] No quote last post

Posted: Fri Feb 08, 2019 4:43 pm
by eunaumtenhoid
would be possible an extension of this, but only to not be able quote the first post (TOPIC)?

Re: [DEV] No quote last post

Posted: Fri Feb 08, 2019 6:58 pm
by tojag
Yes. It is possible. It is easy to doing an extension with this functionality only... or this two functionality together. But I don't know yet how to create configuration and give a possibility to select one of this two or two together :oops:
As I see, I need to create something to store data in DB and an template to ACP for manage settings of this extension. At now it is too much for me, I am novice but if You want, I can create special version 'no_quote_first_post'.

-----
Edit
-----
I've created 'no quote first post' (nqfp) https://github.com/gz73/no_quote_first_post.git
nqlp and nqfp can works together.

Re: [DEV] No quote last post

Posted: Sat Feb 09, 2019 11:01 pm
by eunaumtenhoid
excellent work, I hope you can join the two extensions and create a configuration in the ACP to switch on / off among other options

TY

Re: [DEV] No quote last post

Posted: Mon Feb 18, 2019 10:20 pm
by Big Monstro
tojag wrote:
Thu Feb 07, 2019 8:05 pm
I was inspired by this https://www.phpbb.com/customise/db/exte ... ast_post_2
Your approach is quite different. The alex75's extension uses CSS rule to hide quote button, while yours uses a PHP file to actually remove the quote button. I prefer your extension because it's style neutral: the alex75's one for phpBB 3.1x works only on prosilver or similar custom styles whereas your extension can work on any board style.
tojag wrote:
Thu Feb 07, 2019 8:05 pm
If someone copies the last post into a [quote] [/quote] or use quote button from topic review (under post editor) extension does not effect.
I've managed to remove the quote button for the last post in topic review (under post editor).

First, replace these lines...

Code: Select all

	public static function getSubscribedEvents()
	{
		return array(
			'core.viewtopic_modify_post_row'	=> 'viewtopic_modify_post_row',
		);
	}
... by that

Code: Select all

	public static function getSubscribedEvents()
	{
		return array(
			'core.viewtopic_modify_post_row'	=> 'viewtopic_modify_post_row',
			'core.topic_review_modify_row' => 'topic_review_modify_row',
		);
	}
Then, add the topic_review_modify_row function in your code

Code: Select all

	public function topic_review_modify_row($event)
	{
		$post_row = $event['post_row'];
		if ($event['current_row_number'] == 0)
		{
			$post_row['POSTER_QUOTE'] = '';
		}
		$event['post_row'] = $post_row;
	}
The topic review row displays the last post at the first place, that's why its current_row_number is zero.

For unmodified prosilver board style, I think it's enough.

======================================

However, some custom styles could display quote button in post review too. That row is usually displayed above the editor and lists the posts sent before you submit/preview but after you go to the editor (or after the previous time you previewed your text). The earliest new post is displayed at the first place, like viewtopic.php. The easiest way to prevent quoting last post from post review row is simply remove all quote buttons from that row, thus restore the default prosilver design.

Code: Select all

	public function topic_review_modify_row($event)
	{
		$post_row = $event['post_row'];
		if ($event['current_row_number'] == 0 || $event['mode'] === 'post_review')
		{
			$post_row['POSTER_QUOTE'] = '';
		}
		$event['post_row'] = $post_row;
	}
Alternatively, you can remove POSTER_QUOTE on all possible rows, except topic_review

Code: Select all

	public function topic_review_modify_row($event)
	{
		$post_row = $event['post_row'];
		if ($event['current_row_number'] == 0 || $event['mode'] !== 'topic_review')
		{
			$post_row['POSTER_QUOTE'] = '';
		}
		$event['post_row'] = $post_row;
	}
Now, it's not possible to quote last post by clicking on a button in the post editor.

Users can still copy/paste the content and add quote tag but it's less convenient.

Re: [DEV] No quote last post

Posted: Tue Feb 19, 2019 1:53 pm
by tojag
Big Monstro wrote:
Mon Feb 18, 2019 10:20 pm
Your approach is quite different.
Yes, I wrote about it -
tojag wrote:
Thu Feb 07, 2019 8:05 pm
But my extension does not interfere with style file.
:)

Thank you for your advice. It is very interesting. Who knows, maybe I will use it in the future.
But ... this extension is intended to hide the 'quote' button only on the posts list - to prevent users from clicking 'quote' instead of 'reply' (accidentally? by mistake? laziness? etc.). When someone clicks the 'reply' and the post edit window appears, in my opinion the quote button should be on the post preview list because at now each action will be intended, not accidental.
As You see above, I used quote button for quoting a piece of Your post. It was last post in this topic. My action was intended. Not mistake, not accidentally.
Regards

ps.
I use my extension on my board a few days and now I have peace from redundant posts containing unnecessary duplication of what is still a bit above.

Re: [DEV] No quote last post

Posted: Thu Jun 20, 2019 10:44 pm
by M.O.B.
I think I stumbled on a bug with this extension when active.

It seems to also hide any other buttons to the right of the quote button.

For example: I have the Thanks for Posts extension installed, and it seems to also hide the thanks button on the last post also. Since that button is placed to the right of the quotes button.

Not sure yet if it hides all other buttons to the right of the Quotes button, but since this is the only extension we've installed that adds a button to the right of it, I think it may affect others?

As soon as I disable your extension, the Thanks button reappears like normal on the last post.