Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Turn bbcode permamanently ON and don't show "Format comments as" row
Is it possible to turn bbcode-format permanently ON for all comments of all users and then turn OFF the "Format comments as" row at the end of the text-input area?
0
This discussion has been closed.
Comments
// Instantiate the bbcode object and add it to the string manipulation methods $BetterBBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BetterBBCodeFormatter"); $Context->StringManipulator->AddManipulator("BBCode", $BetterBBCodeFormatter);
by
// Instantiate the bbcode object and add it to the string manipulation methods $Context->StringManipulator->Formatters = array(); $Context->StringManipulator->GlobalFormatters = array(); $BetterBBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BetterBBCodeFormatter"); $Context->StringManipulator->AddManipulator("BBCode", $BetterBBCodeFormatter);
It should look like that :
(line 36)
// Instantiate the bbcode object and add it to the string manipulation methods $Context->StringManipulator->Formatters = array(); $Context->StringManipulator->GlobalFormatters = array(); $Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'BBCode'; $BetterBBCodeFormatter = $Context->ObjectFactory->NewObject($Context, "BetterBBCodeFormatter"); $Context->StringManipulator->AddManipulator("BBCode", $BetterBBCodeFormatter);
There are some bugs in it, but I don't plan on fixing them. View the source to see the "trick" to getting rid of the formatting options.
// set the default formatter to BBCode $Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'BBCode'; // by only having the BBCode option, you force all other formats to be parsed as BBCode $Context->Configuration['FORMAT_TYPES'] = array('BBCode'); // overwrite a user preference for showing/hiding the format selector radio buttons $Context->Session->User->Preferences['ShowFormatSelector'] = 0;
by
if ( $Context->Session->UserID > 0 && $Context->Session->User->Permission('PERMISSION_HTML_ALLOWED') ) { //Make BBCode formater the only formatter available to post a new comment or to edit an old one $Context->Configuration['DEFAULT_FORMAT_TYPE'] = 'BBCode'; $Context->Session->User->DefaultFormatType = 'BBCode'; $Context->Session->User->Preferences['ShowFormatSelector'] = 0; }
Old posts with html format will be still be parsed correctly and users without html permission won't have access to the bbcode.