[DEV] No quote last post

A place for Extension Authors to post and receive feedback on Extensions still in development. No Extensions within this forum should be used within a live environment!
Suggested Hosts
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: Extensions Development rules

IMPORTANT FOR NEEDED EVENTS!!!
If you need an event for your extension please read this for the steps to follow to request the event(s)
Post Reply
User avatar
tojag
Registered User
Posts: 400
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

[DEV] No quote last post

Post by tojag » Thu Feb 07, 2019 7:19 pm

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
Last edited by tojag on Fri Feb 08, 2019 7:53 pm, edited 1 time in total.
Sorry my english. I hope You understand what I mean.

User avatar
tojag
Registered User
Posts: 400
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [DEV] No quote last post

Post by tojag » Thu Feb 07, 2019 7:20 pm

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
Sorry my english. I hope You understand what I mean.

User avatar
warmweer
Registered User
Posts: 2365
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: [DEV] No quote last post

Post by warmweer » Thu Feb 07, 2019 7:47 pm

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)?
My board's not broken, it just went peculiar

User avatar
tojag
Registered User
Posts: 400
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [DEV] No quote last post

Post by tojag » Thu Feb 07, 2019 8:05 pm

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.
Sorry my english. I hope You understand what I mean.

User avatar
warmweer
Registered User
Posts: 2365
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: [DEV] No quote last post

Post by warmweer » Fri Feb 08, 2019 8:35 am

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
My board's not broken, it just went peculiar

User avatar
eunaumtenhoid
Registered User
Posts: 850
Joined: Wed Jun 03, 2009 12:46 am
Location: ????

Re: [DEV] No quote last post

Post by eunaumtenhoid » Fri Feb 08, 2019 4:43 pm

would be possible an extension of this, but only to not be able quote the first post (TOPIC)?
My translations of the extensions for Brazilian Portuguese
https://github.com/phpBBTraducoes

User avatar
tojag
Registered User
Posts: 400
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [DEV] No quote last post

Post by tojag » Fri Feb 08, 2019 6:58 pm

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.
Sorry my english. I hope You understand what I mean.

User avatar
eunaumtenhoid
Registered User
Posts: 850
Joined: Wed Jun 03, 2009 12:46 am
Location: ????

Re: [DEV] No quote last post

Post by eunaumtenhoid » Sat Feb 09, 2019 11:01 pm

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
My translations of the extensions for Brazilian Portuguese
https://github.com/phpBBTraducoes

User avatar
Big Monstro
Registered User
Posts: 47
Joined: Tue Nov 15, 2016 5:42 pm

Re: [DEV] No quote last post

Post by Big Monstro » Mon Feb 18, 2019 10:20 pm

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.

User avatar
tojag
Registered User
Posts: 400
Joined: Thu Aug 07, 2014 8:00 am
Location: Warsaw, Poland, EU
Name: Gregory

Re: [DEV] No quote last post

Post by tojag » Tue Feb 19, 2019 1:53 pm

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.
Sorry my english. I hope You understand what I mean.

User avatar
M.O.B.
Registered User
Posts: 927
Joined: Tue Jan 04, 2005 1:07 am
Location: San Diego CA USA
Contact:

Re: [DEV] No quote last post

Post by M.O.B. » Thu Jun 20, 2019 10:44 pm

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.
Image

Post Reply

Return to “Extensions in Development”