Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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'); // Default route if starting a new question/thread
- }
- 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');
- // }
- }
- if ($Form->GetValue('Type') == 'Question' && $QuestionButton) {
- $Sender->SetData('Title', T('Ask a Question'));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement