Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
825 views
in Q2A Core by
edited by
Hi,

hiding the buttons "close" and "hide" from questions for users works well. What do I need to modify to hide these buttons for answers and comments too?

OK I found the solution:

    function a_item_buttons($a_item) {
        if (!empty($a_item['form'])) {
            if (qa_get_logged_in_userid() == $a_item['raw']['userid']) {
                /*
                  define('QA_USER_LEVEL_BASIC', 0);
                  define('QA_USER_LEVEL_APPROVED', 10);
                  define('QA_USER_LEVEL_EXPERT', 20);
                  define('QA_USER_LEVEL_EDITOR', 50);
                  define('QA_USER_LEVEL_MODERATOR', 80);
                  define('QA_USER_LEVEL_ADMIN', 100);
                  define('QA_USER_LEVEL_SUPER', 120);
                 */
                if (qa_get_logged_in_level() < QA_USER_LEVEL_EXPERT) {
                    if (isset($a_item['form']['buttons']['close']))
                        unset($a_item['form']['buttons']['close']);
                    if (isset($a_item['form']['buttons']['hide']))
                        unset($a_item['form']['buttons']['hide']);
                }
            }
        }
        qa_html_theme_base::a_item_buttons($a_item);
    }

    function c_item_buttons($c_item) {
        if (!empty($c_item['form'])) {
            if (qa_get_logged_in_userid() == $c_item['raw']['userid']) {
                /*
                  define('QA_USER_LEVEL_BASIC', 0);
                  define('QA_USER_LEVEL_APPROVED', 10);
                  define('QA_USER_LEVEL_EXPERT', 20);
                  define('QA_USER_LEVEL_EDITOR', 50);
                  define('QA_USER_LEVEL_MODERATOR', 80);
                  define('QA_USER_LEVEL_ADMIN', 100);
                  define('QA_USER_LEVEL_SUPER', 120);
                 */
                if (qa_get_logged_in_level() < QA_USER_LEVEL_EXPERT) {
                    if (isset($c_item['form']['buttons']['hide']))
                        unset($c_item['form']['buttons']['hide']);
                }
            }
        }
        qa_html_theme_base::c_item_buttons($c_item);
    }
 

Thank you!

christoph
Q2A version: 1.6.2
by
Good challenge !!

Please log in or register to answer this question.

...