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.