You don't even have to use the conditional. The Discussion or Comment will be in $Sender->EventArguments['Object'] regardless of what type it is.
$Sender->EventArguments['Object']
$Sender->EventArguments['Object']->Body = ParseSyntax($Sender->EventArguments['Object']->Body);
$Args['Object']
<?php if (!defined('APPLICATION')) exit(); $PluginInfo['PlainFormatter'] = array( 'Name' => 'Plain Formatter PLUGIN', 'Description' => 'Very plain formatter', 'Version' => '1.0', 'Author' => "JohansonLocker", 'AuthorEmail' => '', 'AuthorUrl' => '' ); Gdn::FactoryInstall('BBCodeFormatter', 'PlainFormatter', __FILE__, Gdn::FactorySingleton); class PlainFormatter extends Gdn_Plugin { public function Format($Text) { return "<font color=red>PlainFormatter<br><font><font color=0>".$Text; } public function Setup() {// Nothing to do here! } }
Comments
$Sender->EventArguments['Object']->Body = ParseSyntax($Sender->EventArguments['Object']->Body);Cool.
$Args['Object']with the second parameter being $Args<?php if (!defined('APPLICATION')) exit(); $PluginInfo['PlainFormatter'] = array( 'Name' => 'Plain Formatter PLUGIN', 'Description' => 'Very plain formatter', 'Version' => '1.0', 'Author' => "JohansonLocker", 'AuthorEmail' => '', 'AuthorUrl' => '' ); Gdn::FactoryInstall('BBCodeFormatter', 'PlainFormatter', __FILE__, Gdn::FactorySingleton); class PlainFormatter extends Gdn_Plugin { public function Format($Text) { return "<font color=red>PlainFormatter<br><font><font color=0>".$Text; } public function Setup() {// Nothing to do here! } }but there's a bug - Factory doesn't work on Discussiom subject post.
the one is bbcode for replies, and the other is html for subject with same parser.