MyBB Using Style Tags in myBB

Allows you to use style tags in your myBB posts and profile fields.

  1. moosetracks114
    In the most recent versions of myBB (I believe since 1.6.10), users have been unable to use the <style> tag in their posts. For normal forums, that isn't an issue, but for RP forums where users frequently use tables or other postscripts, it's handy to be able to chuck all your style information in that style tag and away you go. This is a brief guide on how to allow your board to continue to use <style> tags.

    This change requires a core file edit. Be sure to save a backup.
    I would recommend using the Patches plugin, which allows you to manage core file edits from the admin control panel. This lets you easily revert and disable those changes.

    1. Open up inc/class_parser.php
    2. Find, around line 117:
      Code:
      while(preg_match("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", $message))
    3. Replace with:
      Code:
      while(preg_match("#<script(.*)>(.*)</script(.*)>#is", $message))
    4. Find, around line 119:
      Code:
      $message = preg_replace("#<s(cript|tyle)(.*)>(.*)</s(cript|tyle)(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
    5. Replace with:
      Code:
      $message = preg_replace("#<script(.*)>(.*)</script(.*)>#is", "&lt;s$1$2&gt;$3&lt;/s$4$5&gt;", $message);
    6. Save and upload
    You should now be able to use style tags in your posts and profile fields, if HTML is enabled.

Recent Reviews

  1. Gina
    Gina
    5/5,
    This is fantastic. I've been fighting with this for a while. I used myBB code to get around this but I'm super glad we don't need to use that anymore.
    1. moosetracks114
      Author's Response
      Thank you! Glad you found it useful. I can understand why the developers would want to take it out, but it can make using postscripts on RP forums obnoxious.