Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
74 views
in Q2A Core by
Is there a good way we can allow special users (Editors, Moderators, Admins) to do posting overriding the site settings like minimum post length etc?
Q2A version: 1.8

1 Answer

+1 vote
by
selected by
 
Best answer

Yes. Do something like this:

1. Hook on any piece of code that gets fired before the filter_question() function is run in ask.php. I think a process module would be the best option for this case.

2. Replace any setting that is blocking a user from posting (checking all needed privileges first):

global $qa_options_cache;

$qa_options_cache['min_len_q_content'] = 0;

Note I'm not using qa_opt() as you don't want to change the setting in the database. Only the one in memory. If you are wondering if it will or will not affect other users, the answer is: no, it is alive only during the duration of the HTTP request.

3. Strictly speaking, that's it, because this will fool the filters. One thing that might (or not) be relevant is undoing the memory change from #2. If it is needed and when it is needed, it depends on what other things depend on the setting AFTER the filters are run. From Q2A perspective, nothing, but I can't tell if you have other plugins that rely on that setting. I believe using the event module should be quite a decent solution to that unlikely problem.

by
Thank you Pupi. That's a nice solution
...