Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+4 votes
in Q2A Core by
I'm creating a page to bulk upload questions based on the suggestion given in Q2A Q&A site. Now I want to restrict that page only to admin.

Could you please suggest any hint?


1 Answer

+2 votes
Best answer
You can use the following code:

if (qa_get_logged_in_level($qa_db)<QA_USER_LEVEL_ADMIN)
    qa_fatal_error('Only admins can access this page');

Make sure you do this after calling: qa_base_db_connect()
Thanks gidgreen.. If i want to restrict a page only to logged in users what changes should i do in this code?