Fethi.dz
Well-known member
Hi,
This is my 1st add-on that I try to code on XF2, I face some difficulties to set the proper way to get the permission for groups.
I extended the class Thread as follow:
I have add the Class extensions in Admin CP, Base class name:
Now the problem that I face is, when I go to that nodes permission and set the new option to No for example Admin group I expect the correct output of the extended Thread class but if I set the option No in the group permissions noting change even if the node permission for that group is Inherit. The strange thing is when I set the option to Never in the group permissions the node permission for that group when is set to Inherit it get the option from the group permission as Never.
My questions is: how to make the Inherit option of the node permissions follow the option set in the group permissions & vice versa if I change the node permission for that group it will overide the group permission
This is my 1st add-on that I try to code on XF2, I face some difficulties to set the proper way to get the permission for groups.
I extended the class Thread as follow:
PHP:
<?php
namespace FL\ForumPermissions\XF\Entity;
class Thread extends XFCP_Thread
{
public function canReply(&$error = null)
{
$visitor = \XF::visitor();
$nodeId = $this->node_id;
if (!$visitor->hasNodePermission($nodeId, 'postRepliesOthers'))
{
return false;
}
return true;
}
}
I have add the Class extensions in Admin CP, Base class name:
XF\Entity\Thread
, Extension class name: FL\ForumPermissions\XF\Entity\Thread
Now the problem that I face is, when I go to that nodes permission and set the new option to No for example Admin group I expect the correct output of the extended Thread class but if I set the option No in the group permissions noting change even if the node permission for that group is Inherit. The strange thing is when I set the option to Never in the group permissions the node permission for that group when is set to Inherit it get the option from the group permission as Never.
My questions is: how to make the Inherit option of the node permissions follow the option set in the group permissions & vice versa if I change the node permission for that group it will overide the group permission
Last edited: