Advertisement
Guest User

Untitled

a guest
Jan 13th, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.27 KB | None | 0 0
  1. public function PostController_Render_Before($Sender, $Args) {
  2.         $Form = $Sender->Form; //new Gdn_Form();
  3.         $QuestionButton = !C('Plugins.QnA.UseBigButtons') || GetValue('Type', $_GET) == 'Question';
  4.         if (!$Form->IsPostBack()) {
  5.             if (!$Form->GetValue('Type')) { // Enter here when editing a new discussion  OR new thread/question
  6.                 if (property_exists($Sender, 'Discussion'))
  7.                     $Form->SetValue('Type', 'Discussion'); // Editing an existing discussion
  8.                 else
  9.                     $Form->SetValue('Type', 'Discussion');  // Default route if starting a new question/thread
  10.             }
  11.             else
  12.                 $Form->SetValue('Type', 'Question'); // If not editing an existing discussion, must be a question
  13.  
  14.             // The following is old from 2.0.18.4
  15.             //         if (!property_exists($Sender, 'Discussion')) {
  16.             //            $Form->SetValue('Type', 'Question');
  17.             //         } elseif (!$Form->GetValue('Type')) {
  18.             //            $Form->SetValue('Type', 'Discussion');
  19.             //         }
  20.         }
  21.         if ($Form->GetValue('Type') == 'Question' && $QuestionButton) {
  22.             $Sender->SetData('Title', T('Ask a Question'));
  23.         }
  24.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement