Use the stable version on the main downloads site if you are unwilling to expect problems like this.
No, I didn't. See above for the posted solution. If someone could edit that post to make it seem legible, that would be greaaat. Not sure why our editor here is always seems to do that.
Don't use the mangled code above, just use the code in this link:
Edit: This is for a related alterative fix for this topic here: http://vanillaforums.org/discussion/comment/161856/
Edit: further testing showed that simply changing the view caused problems when editing existing.
Ok, here is my solution:
- Open up the `class.qna.plugin.php` at `.../vanilla/plugins/QnA/class.qna.plugin.php`
- Locate lines 392 and change the function `PostController_Render_Before($Sender,$Args)` to the following:
`public function PostController_Render_Before($Sender, $Args) {
$Form = $Sender->Form; //new Gdn_Form();
$QuestionButton = !C('Plugins.QnA.UseBigButtons') || GetValue('Type', $_GET) == 'Question';
if (!$Form->IsPostBack()) {
if (!$Form->GetValue('Type')) { // Enter here when editing a new discussion OR new thread/question
if (property_exists($Sender, 'Discussion'))
$Form->SetValue('Type', 'Discussion'); // Editing an existing discussion
else
$Form->SetValue('Type', 'Discussion'); // Place your default route if starting a new question/thread here!
}
else
$Form->SetValue('Type', 'Question'); // If not editing an existing discussion, must be a question
// The following is old from 2.0.18.4
// if (!property_exists($Sender, 'Discussion')) {
// $Form->SetValue('Type', 'Question');
// } elseif (!$Form->GetValue('Type')) {
// $Form->SetValue('Type', 'Discussion');
// }
}`
`
You place the default route, whether it be `Question` or `Discussion` in the code above.
There are three test cases:
1. Begin a new thread and check to see that your default route is the active one
2. Edit an existing question and make sure the correct button is selected
3. Edit an existing discussion and make sure the correct button is selected
That may be a little bit difficult, but certainly doable. Before it searches, you can check what user is performing the request (if he is logged in or not) and then add another filter on the CategoryID (catid). You can do that around here.
You will want to use SetFilter. Probably want to use exclude = true. Exclude the CategoryIDs that you don't want to be displayed. Any threads/posts under that Category will not be returned.