Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Add Privacy function to questions

+2 votes
48 views
asked Sep 12 in Q2A Core by john123
Add Privacy Function to php site.

1. All questions are viewed by all users. I want them private. Can't be viewed.

2. I need them to be viewable by users who asked them only. Other users and visitors can not view them.

3. teacher/admin can view everything.

This privacy functions hides other user's question content only. but not question title, answers and comments

class qa_html_theme_layer extends qa_html_theme_base {
   public function q_view_content($q_view) {
    if(isset($q_view['content'])) {
        if(qa_is_logged_in() && $q_view['raw']['handle'] != qa_get_logged_in_handle()
        ||(!qa_is_logged_in() && $q_view['who']['data'] != qa_lang_html('main/me'))) {
            unset($q_view['content']);  
        }
    }
    qa_html_theme_base::q_view_content($q_view);
}

}

can anyone modify this code to make questions private from non-authors?
Q2A version: latest
commented Sep 12 by esqeudero
it will be a good idea if q2a developers integrate a privacy system on questions with options: "Anyone, Only Me, Only users with high points than X and etc."
commented Sep 12 by john123
I agree.

I want students to send me questions in private so i can answer them in private instead of showing conversations to everyone on site.

Please log in or register to answer this question.

...