Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
[Solved] A single response removes thread from "Unanswered" tab
kirkpa31
✭✭
When a user leaves a comment to a question, the post no longer appears under the "Unanswered" tab. How can I change this so that it is only removed from this tab once someone selects "accept" to a response?
I'm sure this is an easy rearrangement of words within /plugins/qna/class.qna.plugin.php only I am struggling to find where.
0
Comments
I'm guessing that this is the code that needs to be altered.
// Mark the question as answered. if (strtolower($Discussion['Type']) == 'question' && !$Discussion['Sink'] && !in_array($Discussion['QnA'], array('Answered', 'Accepted')) && $Discussion['InsertUserID'] != Gdn::Session()->UserID) { $Sender->SQL->Set('QnA', 'Answered');
And this one
$Count = Gdn::Cache()->Get('QnA-UnansweredCount'); if ($Count === Gdn_Cache::CACHEOP_FAILURE) $Count = ' <span class="Popin Count" rel="/discussions/unansweredcount">'; else $Count = ' <span class="Count">'.$Count.'</span>'; echo '<li'.$CssClass.'><a class="TabLink QnA-UnansweredQuestions" href="'.Url('/discussions/unanswered').'">'.T('Unanswered Questions', 'Unanswered').$Count.'</span></a></li>'; }
Figured it out. Only needed to modify the first bit of code I posted above.
Replace the code with:
// Mark the question as answered. if (strtolower($Discussion['Type']) == 'question' && !$Discussion['Sink'] && ($Discussion['QnA']) == 'accepted' && $Discussion['InsertUserID'] != Gdn::Session()->UserID) { $Sender->SQL->Set('QnA', 'Answered');
Simply needed to get rid of the array.
crap now that messes up the popup boxes for this plugin. ugh still working on it I suppose.
Q&A recognizes both replies to a question thread and the accepted reply as being "answered" and therefore does not include the associated question thread within the Unanswered tab. I've just cut my losses and re-labeled this tab "Unassisted" to mean questions that have no replies at all.
If anyone comes up with a stroke of genius to somehow create/change this tab so that it counts all questions as unanswered until they have been accepted, I would be truly appreciative.
No longer need this, kind of enjoy having the posts counted with no replies. Sry for the wasted thread, I suppose.
GOT IT!!!
well after taking a couple weeks away from this topic, and realizing that in fact I do need this tab to include all discussions - even those that have been replied to - I went back to look in the class.qna.plugin.php file and just had to simply add two words within:
Add the word 'Answered' to the arrays as follows:
Line 260:
$Sender->SQL->WhereIn('d.QnA', array('Unanswered', 'Rejected', 'Answered'));
Line 326:
Gdn::SQL()->WhereIn('QnA', array('Unanswered', 'Rejected', 'Answered'));
very.happy.right.now.