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.
Options

Turn bbcode permamanently ON and don't show "Format comments as" row

uziuzi
edited December 2006 in Vanilla 1.0 Help
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?

Comments

  • Options
    MarkMark Vanilla Staff
    It could probably be done as an extension. I haven't tried this, but my guess is that all you'd have to do is hook into the StringManager and remove the Text formatter from the formatters collection, leaving only the other formatters you have installed. If you only had the BBCode formatter installed, then the "format comments as" would disappear and the BBCode would be default.
  • Options
    hm, I found stringmanipulator in framework folder, is it this?
  • Options
    I havn't try it yet but try to replace in BetterBBCode/default.php, Line 36 // 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);
  • Options
    edited September 2006
    I just tested it (with something else than bb) and it work fine if no comments have been saved before in on other format. I will check tommorow if there is on other way to fix that, but you can change the format of your comments in the database.
  • Options
    edited September 2006
    Ok, no need to change the FormatType in the database.

    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);
  • Options
    @Dinoboff Your solution looks wonderful and it's what I thought to do as well, but it just makes the Text and BBCode options disappear and then the BBCode tool bar is disabled. Any other suggestions from anyone? I would think it would be as simple as just adjusting something in the control panel, but unfortunately it's not.
  • Options
    try to adapt that http://lussumo.com/community/discussion/3888/?Focus=46861#Item_24 to the bbcode formatter
  • Options
    Ahem

    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.
  • Options
    edited December 2006
    You should replace // 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.
This discussion has been closed.