Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

How to limit access for some categories?

+2 votes
104 views
asked Jan 30 in Q2A Core by Phillipe Tramontano
edited Jan 30 by Phillipe Tramontano
Example,

Only USER_IT permission is enable to see questions and answers from categorie  IT
Q2A version: 1.7.4

2 Answers

+2 votes
answered Jan 30 by bluegenel
selected Jan 31 by Phillipe Tramontano
commented Jan 31 by pupi1985
The thing with these approaches you suggested is the one I mentioned in this comment: http://www.question2answer.org/qa/55363?show=55365#c55365

If you use a layer then you shouldn't get rid of the elements in the question lists. Both plugins do so, which means each page with hidden questions becomes smaller in size. As I mentioned in my post, a better approach is to display the question but don't allow the user to read it (in any way). That way you won't face the awkward situation in which you browse a question page and you see no question in that page (because it is full of hidden questions that are not being displayed at all).

The only way to solve this is by hacking the core, which is explained in the related question in my answer. I'd still wouldn't advise that, though.
commented Jan 31 by bluegenel
Yes and I commented that on my forum I set the question list to 50 and so would not be a major problem for me and advised people to keep this in mind.
+3 votes
answered Jan 30 by pupi1985
USER_IT is not part of Q2A. So you will first need to develop your own permission system that will support the USER_IT permission and then limit access to the categories based on it.

Once you have developed your custom permission system, you will have to develop a plugin to limit access to users without that permission. You can do that using a layer. So each time you display a question you just remove the content or shown an error or do whatever you want.

Regarding question lists... that is the main issue. There is no way to properly remove a question without hacking the core. Maybe you could just display the question in the list removing the title and adding instead a "You don't have access to see this question" message. You can do that with a layer, again.

Related post: http://www.question2answer.org/qa/54987
Plugin layers docs: http://docs.question2answer.org/plugins/layers/
...