Prohibit reactions in certain forums and/or for specific user groups

Prohibit reactions in certain forums and/or for specific user groups

UnstucK

Administrator

Staff member
Vip Member
Reputation: 100%
Reaction score
48
Points
55
Compatibility with XenForo: 2.1
Prohibit reactions in certain forums and/or for specific user groups.

Edit Template: post_macros

Find near Line: 138 -> <xf:contentcheck>
after <xf:contentcheck> and before
PHP:
   <xf:react content="{$post}" link="posts/react" list="< .js-post | .js-reactionsList" />

insert:
PHP:
<xf:comment>Deny reaction edit-1</xf:comment>
<xf:if is="!in_array($__globals.forum.node_id, [5,14,16,27])">
  <xf:if is="!$xf.visitor.isMemberOf([14,17,24,29])">

under the following line of code
PHP:
<xf:react content="{$post}" link="posts/react" list="< .js-post | .js-reactionsList" />

insert:
PHP:
  </xf:if>
</xf:if>

After you have saved this, the button "Like" is missing in the forums with the registered node_ids.
The same applies globally to the user groups whose IDs are entered in isMemberOf.
Of course, only one of the two modifications can also be used.


If now also the same user groups, and / or in the same forums already forgiven reactions are to be hidden, search the following line of code in the same template: (arround the Linenumber 272)
PHP:
<div class="reactionsBar js-reactionsList {{ $post.reactions ? 'is-active' : '' }}">

before add:
PHP:
<xf:comment>Deny visible reaction edit-2</xf:comment>
<xf:if is="!in_array($__globals.forum.node_id, [5,14,16,27])">
  <xf:if is="!$xf.visitor.isMemberOf([14,17,24,29])">

after </div> add:
PHP:
  </xf:if>
</xf:if>
 
Back
Top