XF 2.2 Validation & setupThreadCreate


What am I missing here? I'm extending XF\Pub\Controller\Forum.php and changing the title and message body in the setupThreadCreate function, this means that there will always be content in the message body but I'm getting a "Please enter a valid message." error.

My code is basically this once all the conditionals and data manipulation are removed:
protected function setupThreadCreate(\XF\Entity\Forum $forum)
    $creator = parent::setupThreadCreate($forum);
    $creator->setContent("New Title Stuff Here", "And new message body here");   
    return $creator;

The data seems to be re-validated after this as it doesn't whinge about the title being blank, only the message. Do I need to manually validate or am I setting the message body in the wrong way? If there is a message body posted then this code overrides it just fine.

Top Bottom