ACL - restricting text to only certain plans

  • Bill
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 5 months ago #151077 by Bill
Hi Tuan,

I have been having a problem with ACL where I want to show text for all plans, except plans 1, 3 or 4.  So I have coded the text as follows:
{mprestriction ids="!1,3,4"}Members can access the Annual Financial Statements by logging in and returning to this menu.{/mprestriction}
but it doesn't work.
I have had a look at the code in plugins/content/mprestriction/mprestriction.php and it appears to me (and I could be totally wrong) that line 130:
if (!count(array_intersect($requiredPlanIds, $activePlanIds)))
should be:
if (count(array_intersect($requiredPlanIds, $activePlanIds))==0)
as I don't think the php ! operator works in that situation.

Please let me know.  I have made the change and it then does work correctly.

Regards,

Bill

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #151079 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic ACL - restricting text to only certain plans
Hello Bill

I would say that the two commands should work in the same way, although the == operator makes the code a bit more clear

As the code is more clear, and it works. I will make this change to core package. So you don't have to worry about it for future update

Tuan

Please Log in or Create an account to join the conversation.

  • Bill
  • Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
3 years 5 months ago #151081 by Bill
Many thanks Tuan.

Regards,

Bill

Please Log in or Create an account to join the conversation.

More
3 years 5 months ago #151082 by Tuan Pham Ngoc
Replied by Tuan Pham Ngoc on topic ACL - restricting text to only certain plans
You're welcome

Please Log in or Create an account to join the conversation.