Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Try Vanilla Forums Cloud product

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

This discussion is related to the Q&A addon.
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.

JanHooshgtonightUnderDogr0obertvirtualdavid

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.

    JanHoosvirtualdavid
  • 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.

    vrijvlinder
  • 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.

    MasterOne
  • 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 :)

    peregrinevrijvlinder
  • 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. :)

    peregrinejsabean
  • @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.

  • Problem solved here using the copy paste steps, thank you

    peregrineUnderDoghgtonightnuwan94
  • 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 !

    vrijvlinder
  • 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.

    hgtonightvrijvlinder
  • 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.

    VanillaplusBleistivt
  • 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.

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator

    The easiest thing would be to create your own view for that module.
    Copy the theme you are using and make it a new theme. In your theme, copy /applications/vanilla/views/modules/newdiscussion.php to /themes/YOURTHEME/views/modules/newdiscussion.php

    You can now edit this copy. You should enclose 2 lines in there:

    $Question = $this->Buttons[1];
    unset($this->Buttons[1]);
    

    You need $Question['Text'] and Question['Url'] for your custom html and by unsetting the value, you prevent Vanilla from rendering a button with a dropdown arrow.

    You would need to write some lines of JavaScript that change the link of the button depending on the radio button to either $this->Button['Url'] or $Question['Url'] and you can consider to also change the text of the button to either $this->Button['^Text'] or $Question['Text']

    hgtonightcollentswhu606
  • @R_J Wow, thanks very much for that!

  • After adding The Big Button option part A code giving error from Unanswered question page. (something has gone wrong)

    help me @peregrine @R_J

  • R_JR_J Cheerleader & Troubleshooter Munich Moderator
  • It's not working on
    Version 2.2.1

  • I followed the steps in the first 3 comments from the top, and it all works fine, but I get this big error when I click Unanswered Questions in the menu.

    I

  • Also, in the comments section I get this warning.

Sign In or Register to comment.