Users running a non-download version of Vanilla (pulled from github), on branch release/2019.016 or master from the last 2 weeks should upgrade to release/2019.017 or latest master for security reasons. Downloaded official open sources releases are not affected.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

BBCode Not Working

I'm converting an SMF site to use Vanilla, and there is a ton of BBCode--from people's quotes, to images, etc.

I added this guy:

$Configuration['Garden']['InputFormatter'] = 'BBCode';

Into my config, and that took care of a lot of the BBCode.

However, some things did not get converted over (like center and hr).

Any ideas on why those specifically would be broken? Moreover, could I extend the BB parser to fix them if they are simply not implemented.

Tagged:
«1

Comments

  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2013

    Possibly a theme has something to do with it. I know I code css for hr as far as color and thickness but not need to code for center it is always center...

    can you elaborate on the Vanilla version number ? Which editor do you use ?

  • It's vanilla 2.0.18.10. A fresh install essentially. I'm using the traditional plugin and a reskinned version of the theme that goes with it: http://vanillaforums.org/addon/traditional-plugin

    UnderDog
  • vrijvlindervrijvlinder Papillon-Sauvage MVP
    edited December 2013

    I can only suggest you inspect the element which is acting badly and find out what rule is causing it from where. It could very well be a css issue. You simply need to investigate further . Look in the css files if there is anything causing that. Then correct it.

  • WuzseenWuzseen New
    edited December 2013

    I don't think I was clear, sorry about that--the BBcode itself is still visible! So i see the [center][/center] tags in the post.

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Oh ok now I understand , the formatting is showing ... hmmm and those are the only ones that show the center and hr ? very odd indeed unless they are not allowed to be used by something

    if you use html formatting you can add allowed thing such as this in the config.php but I am not sure if this would also apply to BBCode .

    $Configuration['Garden']['Html']['AllowedElements'] = 'a, abbr, acronym, address, area, audio, b, bdi, bdo, big, blockquote, br, caption, center, cite, code, col, colgroup, dd, del, details, dfn, div, dl, dt, em, figure, figcaption, font, h1, h2, h3, h4, h5, h6, hgroup, hr, i, img, ins, kbd, li, map, mark, menu, meter, ol, p, pre, q, s, samp, small, span, strike, strong, sub, sup, summary, table, tbody, td, tfoot, th, thead, time, tr, tt, u, ul, var, video, wbr,marquee';

  • That didn't seem to do it. Hmm, do you know which file does the bb code parsing?

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Have you tried this plugin ? http://vanillaforums.org/addon/nbbc-plugin

    Seems this issue has happened to others before, I do not use BBCode in My forum but maybe someone else has some idea of what is doing this.

  • I have, that just basically creates a bunch of garbage.

  • WuzseenWuzseen New
    edited December 2013

    Fixed it! My knowledge of recursive descent parsers came in handy.

    In class.format.php in library/core add these lines:

     $Mixed2 = preg_replace("#\[center\](.*?)\[/center\]#si",'<center>\\1</center>',$Mixed2);
     $Mixed2 = preg_replace("#\[hr\]#si",'<hr>',$Mixed2);
    

    Into
    public static function BBCode($Mixed)

    At around line 262

    vrijvlinderUnderDoghgtonight
  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    That is awesome and thanks for coming back with the fix, it should help someone else for sure !!

    :)

  • @Wuzseen said:
    Fixed it! In class.format.php in library/core add these lines:
    Into
    public static function BBCode($Mixed)

    At around line 262

    Thanks man! I'll make a bug report and add your code, so the Vanilla guys can add it to 2.1

  • I doubt you will get it in the core, for one you can create your own formatters as a plugin, secondly the is no BBCode standard, so there is no reason at all to include hr or center support (which is a deprecated html element anyway). There is not reason to include table support, etc.

    better idea would be to convert the bbcode in the database to html. (backup first).

    Changes tot he core will get overwritten when you update.

    grep is your friend.

    UnderDog
  • Whooopz, so no bug report from me then ... sorry.

  • edited May 2014

    Hi,

    I'm having the same problem. I converted from SMF 2 and I have messages with "[img]" and "[quote]" bbcode that isn't getting reformatted.

    I just installed Vanilla 2.1 and the class.format.php does have the preg replacements for these, so what could be going wrong? How can I debug this?

    Any help is appreciated.

    thanks
    Ricardo

  • vrijvlindervrijvlinder Papillon-Sauvage MVP

    Make sure you have the plugin htmlawed in your folder of plugins, then make sure it is enabled in the config.php

    If the forum you converted was using BBCode you needy also change the input format to BBCode in the config.php

  • @vrijvlinder said:
    Make sure you have the plugin htmlawed in your folder of plugins, then make sure it is enabled in the config.php

    If the forum you converted was using BBCode you needy also change the input format to BBCode in the config.php

    Thanks.

    I do have it enabled, but I'm still getting the bbcode text in the posts

    I have in config.php:
    $Configuration['EnabledPlugins']['HtmLawed'] = TRUE;
    $Configuration['Garden']['InputFormatter'] = 'BBCode';

    Is there a way to debug why the stuff is not getting converted?

  • I recommend you make it

    $Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';

    for the simple reason when people tell you to make all your plugins that say TRUE to FALSE or during deletion, you won't make a mistake and remove the HtmLawed plugin inadvertently.

    Are you having trouble with new comments and discussions or old one.

    if it is an old comment or discussion. you need to check the formatting in the commesnt and discussuion tables.

    there are a number of discussions about this.

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • @peregrine said:
    I recommend you make it

    $Configuration['EnabledPlugins']['HtmLawed'] = 'HtmLawed';

    for the simple reason when people tell you to make all your plugins that say TRUE to FALSE or during deletion, you won't make a mistake and remove the HtmLawed plugin inadvertently.

    Are you having trouble with new comments and discussions or old one.

    if it is an old comment or discussion. you need to check the formatting in the commesnt and discussuion tables.

    there are a number of discussions about this.

    Thanks, I appreciate your help. This is all relative to old discussions. I've just done some searching on "formatting comments table" but not much luck in finding something specific to this. Maybe I'm not using the proper search string.

    Is there a tutorial? I'm assuming I'd have to go into the database and change some of the text?

  • BTW, this only happens when I'm inside a discussion. If I go outside to any other area, the MeBox configuration is honored.

    But inside the discussion, the body.Vanilla.Discussion configuration takes precedence. I do have the MeBox last in the css file

  • Sorry for my post above, it was for another topic. How do I delete it?

Sign In or Register to comment.