HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

Some adjustments to more clearly see Ask a Question in Q & A 1.2.1 (new discussion button).

peregrineperegrine MVP
edited May 2014 in Feedback

The Big Button option part A

add this to class.qna.plugin.php

public function DiscussionsController_Render_Before($Sender) {
      if (C('Plugins.QnA.UseBigButtons')) {
         $QuestionModule = new NewQuestionModule($Sender, 'plugins/QnA');
         $Sender->AddModule($QuestionModule);
      }

      if ($Sender->Data('Discussion.Type') == 'Question') {
         $Sender->SetData('_CommentsHeader', T('Answers'));
      }
   }

above this

   /**
    * Add 'Ask a Question' button if using BigButtons.
    */

add these lines to your config.php

$Configuration['Plugins']['QnA']['UseBigButtons'] = TRUE;

$Configuration['Modules']['Vanilla']['Panel'] = array('MeModule', 'UserBoxModule', 'GuestModule', 'NewDiscussionModule', 'NewQuestionModule','DiscussionFilterModule', 'SignedInModule', 'Ads');


you should now see a big button Ask a Question directly below the "New Discussion button".

maybe this will help you guys

@AbhinavG @MasterOne @der_k @JanHoos

in reference to

http://vanillaforums.org/discussion/26809/q-a-plugin-not-working

I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

Tagged:
«1

Comments

  • peregrineperegrine MVP
    edited May 2014

    The big Button Option Part B

    you also need to change QnA/modules/class.newquestionmodule.php

    from

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

    to

    echo Anchor(T('Ask a Question'), '/post/question', 'Button BigButton NewQuestion');
    

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited May 2014

    BTW. this was tested in vanilla 2.1

    and one needs to cut and paste correctly. If your cutting and pasting skills are not honed, you may have troubles.

    you may need to use the older version of plugin for 2.0.18.x

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • peregrineperegrine MVP
    edited May 2014

    To debug, if you get a white screen or a bonk, or a whoops, or try back later

    add this line to your conf/config.php

    $Configuration['Debug'] = TRUE;

    in your conf/config.php to reveal full error messages.

    you can set it to FALSE if you are done debugging.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Awesome! It works like a charm. I went for the double button option to make sure my users won't be able to mis it :)

  • thx. Awesome. always good to get at least one person who can use the mods and provide positive feedback.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine, thanks a lot, of course it can't work if commented out. Just uncommenting those lines and the drop down is back. :)

  • @peregrine‌ , thanks :). @MasterOne‌ , just uncommenting those lines fixes the plugin ?

  • peregrineperegrine MVP
    edited May 2014

    @peregrine‌ , thanks :). @MasterOne‌ , just uncommenting those lines fixes the plugin ?

    yes for the dropdown box option. http://vanillaforums.org/discussion/comment/208152/#Comment_208152

    if you want buttons - then you use the first option parts a and b

    http://vanillaforums.org/discussion/26902/some-adjustments-to-more-clearly-see-ask-a-question-in-q-a-1-2-1-new-discussion-button/p1 first two posts.

    you have to be using 2.1 and you might need to make the other fix if you get a fatal error when trying to enable the plugin prior to making modifications.

    http://vanillaforums.org/discussion/comment/207522/#Comment_207522

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • IonmarcuIonmarcu Bucharest

    Problem solved here using the copy paste steps, thank you

  • r0obertr0obert
    edited May 2014

    @peregrine said:

    Either do the steps above in the previous two comment or this below

    Drop Down Option (not the additional Big Button

    The discussion - new question scroll down option with dropdown menu on add discussion

    Another option if you don't want to use big buttons but have a scroll down like the current vanilla site.

    Perfect, works like a charm! The drop-down option is the sexiest one by far, thanks @peregrine !

  • can u tel me in where this code add in to class.pna

    public function DiscussionsController_Render_Before($Sender) {
    if (C('Plugins.QnA.UseBigButtons')) {
    $QuestionModule = new NewQuestionModule($Sender, 'plugins/QnA');
    $Sender->AddModule($QuestionModule);
    }
    if ($Sender->Data('Discussion.Type') == 'Question') {
    $Sender->SetData('_CommentsHeader', T('Answers'));
    }
    }

  • peregrineperegrine MVP
    edited September 2014

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • rotaechorotaecho Los Angeles New

    Big Button method A & B worked for me with 2.1.6 and plugin 1.2.1. I didn't attempt the other method, as I wanted the buttons.

  • @peregrine Please tell me how to change the order of these 2 buttons?

  • peregrineperegrine MVP
    edited August 2015

    @Vanillaplus said:
    peregrine Please tell me how to change the order of these 2 buttons?

    via module sorting in config.php

    $Configuration['Modules']['Vanilla']['Panel'] = array('MeModule', 'UserBoxModule', 'GuestModule', 'NewQuestionModule', 'NewDiscussionModule', 'DiscussionFilterModule', 'SignedInModule', 'Ads');

    vs.

    $Configuration['Modules']['Vanilla']['Panel'] = array('MeModule', 'UserBoxModule', 'GuestModule', 'NewDiscussionModule', 'NewQuestionModule', 'DiscussionFilterModule', 'SignedInModule', 'Ads');

    there are numerous discussions on module sorting, a tutorial on sorting in tutorials category and a plugin that does module sorting.

    see FAQ question 28

    http://vanillaforums.org/discussion/28420/faq-what-frequently-asked-questions/p1

    unfortunately the FAQ is not in the Tutorials category, but you will have to live with it until it is moved.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine It's working.. thank you..!

  • This works thanks, I got the 2 buttons showing and the separate "Ask a Question" button knows which category it's in when it's clicked (as explained in your revised comment here) but I still have the little drop down arrow in the "New Discussion" button.

    Is there any way to show the top button without the drop down arrow if you have a separate Question button?

    As a suggestion for a future update What I would actually prefer is a normal discussion button with a pair of yes/no radio buttons underneath defaulting to "no", with some text asking if it is a question, like this:

    I think the users on my particular forum will get confused about which button to click (and I'll get fed up trying to explain it to them) but they'll soon get the hang of choosing "Yes" if they want to be able to select the best answers.

  • collentscollents New
    edited May 2016

    On reflection I decided I didn't like those 2 big buttons up there so I've gone with this for the time being - I just changed the button text to make it a bit more apparent that there were more options hiding behind the arrow.

    I'm ashamed to say that was a bit of a hack for my own benefit - it would be good to know if there is a safe way to change that button text?

    I'd still prefer an arrow-less button with some radio buttons or an option slider below it, as in my post above.

    Thanks again for the Q&A plug-in... it's a huge help for what we're trying to do with our community.

Sign In or Register to comment.