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.

How to set Default in Q&A Plugin

I'm trying to make "ask a question" not be the default.
I'd prefer the default to be "Start a discussion".
I like the plugin but am not looking to turn the whole forum into a Q&A FAQ thing.
Even better is there a way to Only allow it Under a specific category?

Comments

  • Hi there,

    I'm no expert here but wouldn't modifying the locale.php achieve this result?

    If you've not created one yet, create a file called "locale.php" and upload to "/conf/".

    Inside the file, include the following:

    <?php if (!defined('APPLICATION')) exit();
    $Definition['TEXT_HERE'] = 'TRANSLATION_HERE';
    

    So for example, if those specific words you're wanting to change are "ask a question", use:

    <?php if (!defined('APPLICATION')) exit();
        $Definition['ask a question'] = 'Start a Discussion';
    

    Hope this helps. You can find more information on translations / local files here:

    http://vanillawiki.homebrewforums.net/index.php/Locales
    http://vanillaforums.org/page/localization

  • @OurWebMedia said:
    Hi there,
    I'm no expert here but wouldn't modifying the locale.php achieve this result?

    That won't do. It would just change the label on the buttons, not their behaviour. A solution would be to override, in the theme, the qnapost.php view that comes with the Q&A plugin, and change this line:

    <?php echo $Form->RadioList('Type', array('Question' => T('Ask a Question'), 'Discussion' => T('Start a New Discussion'))); ?>
    

    to this:

    <?php echo $Form->RadioList('Type', array('Question' => T('Ask a Question'), 'Discussion' => T('Start a New Discussion')), array('Default' => 'Discussion')); ?>
    

    I haven't tested it, but it should default the selection to Discussion.

  • the line I see is in /plugins/views
    I can't find qnapost.php anywhere in the themes folders.

    <?php echo $Form->RadioList('Type', array('Question' => 'Ask a Question', 'Discussion' => 'Start a New Discussion')); ?>

    Doesn't have the "T's" in it. are those escape characters?
    also the Number of close parenthesis don't match.

  • @rakoffron said:
    the line I see is in /plugins/views
    I can't find qnapost.php anywhere in the themes folders.

    Precisely. You have to copy that view in your theme's views folder and modify it (hence the "override it in your theme"). Do not modify the original one in plugin folder.

    <?php echo $Form->RadioList('Type', array('Question' => 'Ask a Question', 'Discussion' => 'Start a New Discussion')); ?>

    Doesn't have the "T's" in it. are those escape characters?

    T() is a global translation function. I must have added it in my own custom version of the plugin.

    also the Number of close parenthesis don't match.

    It does match, as far as I can see. Anyway, that's not a big deal, my example is a suggestion, not a fully tested solution. :)

Sign In or Register to comment.