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.

Tried a few threads, no luck in changing "New Discussion" to "Ask a Question". Running 2.1

I'm trying to change the default button from "New Discussion" to "Ask A question"
I've tried this: http://vanillaforums.org/discussion/21975/how-to-force-ask-a-question-instead-of-new-discussion

But it didn't change much. The biggest change or closest I got to the solution was this:

you also probably want to add this to one of your locale definitions files, or plugins/QnA/locale/en-CA.php or conf/locale.php

$Definition['Start a New Discussion'] = 'Ask a Question';

But all that did was change the button text to "Ask a Question" but the link still takes you to new discussion also the dropdown ended up having 2 "Ask a Question" options.

I just wanted the button to default to "Ask a Question" and the down arrow offering the option to click "New Discussion"

Is this possible on self hosting?h

Tagged:

Best Answers

Answers

  • My only prob now is that there now style for the buttons. See screenshot...

    How do I make those into buttons? Is there something I can add to customs.css

  • mcu_hqmcu_hq ✭✭✭
    edited January 2013

    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 
    
  • Did you reply to the wrong thread maybe?

  • @mcu_hq said:
    If someone could edit that post to make it seem legible, that would be greaaat.

    You like the improvement?

    There was an error rendering this rich post.

  • @mcu_hq said:

    Thank you. I did get it to work but my only problem is that there's no style/buttons.

    Problem:
    On domain.com/post/discussion/ the option show as text as if there's no CSS style. Where can I add the style? custom.css? I'm using v2.1 beta.

    In my style.css there's no class "QnAButton TabLink"

    Click the image below you see the post options show as plain text instead of active and inactive buttons.

    thanks

  • You would edit the plugin's style for that , if it does not have a style sheet you could just add one. A link to the problem would be helpful and more efficient .

  • I upgraded to this version:
    https://github.com/vanillaforums/Addons/tree/release/2.1b1/plugins/QnA

    It does not have any option to switch back and forth on the post page. So no need for buttons.

    Looks a lot like whats used here in this forum

  • edited January 2013

    The name of the class for the buttons is a.BigButton.NewDiscussion or
    a.QnAButton.TabLink, you can add style to them via the custom.css I believe.

    echo Anchor(T('Ask a Question'), '/post/discussion?Type=Question', 'BigButton NewDiscussion');

  • I tried Vanilla.DefaultNewButton = "post/question"
    but it breaks forum with:
    Parse error: syntax error, unexpected '=' in /html/conf/config.php on line 116

  • Yes, "Vanilla.DefaultNewButton" is just shorthand, not what you paste into the config.

  • Ok now that the "ask a question" is now default in the left column. How do I insert an image between the button and the start of the category list?

    thx

Sign In or Register to comment.