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.
simple tweak to default to "start a discussion"?
hi, i've seen this come up before without a detailed response, so nudging the question here:
is there a simple way to set the plugin behavior so that the default behavior for a user clicking on "start a discussion" is actually "start a discussion" with an option to "ask a question"? (right now, as most are aware, it defaults to "ask a question" and inserts that text above the input box, creating possible confusion for a user
alternatively, would it be possible to separate out the action such that a *new* button is inserted in the upper right (default theme example) below "start a discussion" that says" ask a question"? i was thinking about doing this with "pockets" but am not sure what code snippet would go there, nor how i would then remove the option from the standard "start a discussion" link prompting a user to once again "ask a question"
is there a simple way to set the plugin behavior so that the default behavior for a user clicking on "start a discussion" is actually "start a discussion" with an option to "ask a question"? (right now, as most are aware, it defaults to "ask a question" and inserts that text above the input box, creating possible confusion for a user
alternatively, would it be possible to separate out the action such that a *new* button is inserted in the upper right (default theme example) below "start a discussion" that says" ask a question"? i was thinking about doing this with "pockets" but am not sure what code snippet would go there, nor how i would then remove the option from the standard "start a discussion" link prompting a user to once again "ask a question"
Tagged:
1
Answers
@ passing notes
I'm too waiting for a similar functionality. Pls let me know if you have made some progress on this.
i would be happy to know how to default to start a discussion too.
I didn't look into how to make this an "option" in the plugin itself, but to change the default
open class.qna.plugin.php
and change line 395:
from: $Form->SetValue('Type', 'Question');
to: $Form->SetValue('Type', 'Discussion');
you can also change the order the tabs are displayed by modifying qnapost.php
and swapping the order of lines 15 and 16.
I just implemented this on my forum.
homebrewforums.net you can test it out if you like.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
i figured it out myself in case anyone needs the code, here it is
change in class.qna.plugin.php line 412 to 414 from
to
that works for me so far
edit:
oh i did not reload the page before posting : )
thanks for your reply though
i would not change line 414. if i'm reading the code right, it's a failsafe condition that originally said, if you can't get the value of Type from the page, just default to the standard discussion because something is wrong. In my code i have both lines setting the value to Discussion.
maybe @todd can check my understanding of the code.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
thanks for letting me know, i did not realize that
before changing i can only start questions
after changing i can only start discussions
in case of hbf with two lines 'Discussion' i can start only a discussion, too
$Form->SetValue('Type', 'Discussion'); } elseif (!$Form->GetValue('Type')) { $Form->SetValue('Type', 'Discussion');
onclick the Buttons "Ask a Question" or "start Discussion" happens nothing
i think there is an function missing, but which
My Vanilla Version 2.0.18.1
So, which is the best way to implement this functionality because if you are using the mobile theme, users do not have the opportunity to start a discussion at all.
I'd vote for the 'ask a question' button in the top right under the 'start a discussion' button too please. Needs to be clear from the beginning for my users and the current format isn't.
Thank you
Not to resurrect a dead topic but this seems to work... also had to reorder the buttons as @hbf had suggested
I did the same as @Waterskiaddict - changed 411 line to @hbf suggestion:
And now Start a discussion option is chosen by default.
But the order of the buttons is still the same - Ask a Question still comes first. And I wonder how do I change this?
Your question was answered previously...
Did you do this?
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained
OMG, I've totally misunderstood all messages
First, I thought that post with code lines was yours, but it belongs to @fh111. Second I have not noticed your comment about the line 414 - and I agree with you, that line should not be changed. And finally, I have not noticed your remark about swapping the order of lines 15 and 16 - it helped me to change the order of the buttons.
Please, forgive me and thank you so much!
No worries. Glad it worked for you.
Vanilla Wiki, Tastes Great! 31,000 viewers can't be wrong. || Plugin Development Explained