Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+5 votes
523 views
in Q2A Core by
Some of my users ask questions then hide them after they get their answers.

How to block them from hiding their questions?
Q2A version: 1.7x

1 Answer

+3 votes
by
selected by
 
Best answer
I am using the userrules plugin for that purpose:

https://github.com/q2apro/q2apro-userrules

Check the comments in the source to know what else it does:

https://github.com/q2apro/q2apro-userrules/blob/master/q2apro-userrules-overrides.php

In case you do not want to use a plugin, you could use an advanced theme and do (UNTESTED):

        function initialize()
        {
            if($this->template=='question')
            {

                if(qa_get_logged_in_level()<QA_USER_LEVEL_EXPERT) {
                    unset($this->content['q_view']['form']['buttons']['hide']);
                }

            }

        }
by
Thanks again. I looked into your plugin. very helpful
One more thing! How can we do these
1- If the question has received at least one answer the user cannot HIDE it.
2- If the question has received at least one answer the user cannot EDIT it.
by
1 - You get the question id, probably $post['id'], then you query posttype=='A' and  parentid==questionid, if this is >0 then $rules['hideable'] = false;
2 - same as above, then $rules['editable'] = false;
...