Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Limit "liking" access to certain roles

Hi, would it be possible to add a configuration item somehow that will limit the "like" option to certain roles? Let's say I have also a role "senior members", I would only want senior members, moderators and administrators to have access. So not guests, applicants and regular members.
They still should see the likes, just no be able to influence the counter.
I would happily sponsor creating such an additional feature.
0
Comments
this will work - at least it did for me...
change the function to this in LikeThis/default.php
add this to your config.php - if you want to restrict liking to Admin (16)
choose wahtever roleid you want and replace the "16" with the id you want.
e.g.
$Configuration['Plugins']['LikeThis']['LikeRole'] = '16';
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
Thanks!
I was trying out another approach: registering an extra permission and then checking it. However,
it doesn't yet work for me. So I give it another shot and then copy your code :-) thanks again!
Here's a diff of my try with the original code (default.php):
After changing this code you have to disable and enable the code to get the extra permission to register and then check it for every role you like to have access.
I think I got it working now, your code gave me a clue. The code did not check if the user was in the correct role when rendering the view. So I added
in the DiscussionController_CommentOptions_Handler function. That seems to do the trick. However, I am quite tired now and need to recheck when I got some sleep :-)
Thanks for your input!
Your idea is better with register permissions than manually reading roles. You may need to put the conditional in the same place as where I did - if you don't see the likes reflecting the way you want. I haven't tested further, but whatever works for you.
I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.
@martz, if you send me your updated default.php i will merge your changes into the baseline.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
You can download the file here: https://mega.co.nz/#!3EFjiApJ!G_Yx6H9TulH3cdgoXxjgHUsOho4jwJq3iNrQ8BsP8F8
It is important to make clear to forum owners who download the plugin that, once installed, they have to alter their permissions setup. They have to check the permission for the applicable roles, otherwise people get confused!
this has been incorporated into the latest version of the plugin.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained