Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
598 views
in Q2A Core by
I would like only to make the page consumers visible to the administrators and to remove her/it from the menu if it is not loggati as administrators.  
  
How can I do?  
  
Im sorry for the bad English...

1 Answer

0 votes
by
There are various ways to do this, but the best is to use an advanced CSS theme: http://www.question2answer.org/advanced.php#theme-advanced

So, in the theme.php file in your theme directory, try the following:

<?php

    class qa_html_theme extends qa_html_theme_base
    {
        function main()
        {
            global $qa_login_level;

            if (($this->template=='users') && (@$qa_login_level<QA_USER_LEVEL_ADMIN)) {
                // do nothing...

            } else
                qa_html_theme_base::main();
        }

        function nav_list($navigation, $navtype)
        {
           global $qa_login_level;

            if (($navtype=='main') && (@$qa_login_level<QA_USER_LEVEL_ADMIN))
                unset($navigation['user']);
            
            qa_html_theme_base::nav_list($navigation, $navtype);
        }
    }
    
?>

If the viewer is not logged in as admin, the first function above makes the users page blank, and the second function removes the user entry from the navigation menu.

By using a theme, your solution should still work if you upgrade Q2A in future.

(BTW I haven't tested the code above so apologies for any bugs...)
by
I guess its good idea to have "users" tab enable or disable from the admin panel. what do you think?
by
Yes, more control over this should go into version 1.1...
...