i have made an extension that authorize only the author of the topic to post in it.
To made that, i made a listener like this :
Code: Select all
class listener implements EventSubscriberInterface
{
static public function getSubscribedEvents()
{
return array(
'core.viewtopic_modify_post_action_conditions' => 'viewtopic_modify_post_action_conditions',
);
}
public function viewtopic_modify_post_action_conditions($row)
{
global $user, $template;
if ( $row->get_data()['topic_data']['topic_first_poster_name'] != $user->data['username']) {
$template->assign_vars(array('S_DISPLAY_REPLY_INFO' => false));
}
}
}
Code: Select all
<!-- IF postrow.U_QUOTE -->
<li>
<a href="{postrow.U_QUOTE}" title="{L_REPLY_WITH_QUOTE}" class="button icon-button quote-icon"><span>{L_QUOTE}</span></a>
</li>
<!-- ENDIF -->
Best regards
PS : sorry for my bad english, french people you know...