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

Hello :)
I am trying to create a plugin (on a fork of https://github.com/kfuchs/permission2categories) to allow the creation of questions of a category from a rank.

I saw the variable $rules ['viewable'] = 0; which allows to hide the category.

But I can't find the variable to prevent opening a new question ...

$rules ['writable'] ?
$rules ['openable'] ?

I don't know if I am precise!

Q2A version: 1.8.5

1 Answer

0 votes

If you mean preventing someone opening a closed question, then it's $rules['reopenable']

If you mean prevent someone asking a new question, then it won't be part of that area because that is for actions on the current question only. I'm not sure there is an easy way to do it as you only know what category someone is asking in after they have submitted their question.

You could remove the ask button on certain pages by unsetting $qa_content['navigation']['main']['ask'] (would be $this->content inside a theme/layer). And you'd need a filter module that checks for filter_question and looks for $question['category_id']