Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
in Q2A Core by


I needed to add some per-categories permissions so that for some categories, users can only view questions in the category, but not post there. I know there is a plugin for categories permissions (Permissions2Categories), but it does not exactly what I wanted - just blocks questions in some category from being viewed by users with access level below certain value. This is a good starting point plugin indeed (thanks to its author, Kirill Fuchs), but too simple.

So next, I tried to modify the plugin to be able to make permissions more flexible, and I found that it's next to impossible to extend plugin to do what I wanted, because needed core functions were not "overrideable".

Ultimately, I ended up modifying the core qa_question_set_category  and  qa_question_create to do some magic with categories and permissions, returning null if permission check for certain category failed.

I know, that modifying core files is a very bad practice, but I just see no way of doing that via the plugin SDK; maybe I am wrong? The goal is to forbid create questions (but still allow answers and comments) in some certain category (per-category setup is achieved via the above mentioned plugin by Mr.Fuchs), and along with this to disallow change category to forbidden when user editing his own question.

Thanks for the help in advance!

Q2A version: 1.6.3

Please log in or register to answer this question.