Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
785 views
in Plugins by

I find a great plugin "Expert Questions" from NoahY.

This plugin i want to use in this case: User can ask private questions to expert.

I find one problem - anybody can view question by enter direct url ( ***.com/qa/QUESTION_ID/).

Can anybody help me, how can i hide qustion to expert from public access?

This option important for my users, because they can ask very private question (medical).


Add:

I find this param $question['viewable'] in file qa-page-question.php

For expert-question this param set to 1, so anybody can view questions. 

Maybe it`s possyble add in plugin source some code to change this param for expert-questions?

Q2A version: 1.5.4
by
For others, here is the plugin: https://github.com/NoahY/q2a-expert-questions

1 Answer

0 votes
by
 
Best answer

I find reason of my problem.

In admin configuration i leave field "Custom expert users" as blank.

So, then plugin function qa_page_q_post_rules in file qa-expert-overrides.php analyze expert user:

 

$users = explode("\n",$users);
$handle = qa_get_logged_in_handle();
foreach($users as $idx => $user) {
if ($user == $handle) {
$is_expert = true;
break;
}
If param $users blank and user not login ($handle also blank) code return, that the anonym user is expert.
 
To fix this bug, you must change condition from  
 
if ($user == $handle)
 
to this:
 
if ($user != '' && $user == $handle)
...