Parsing BB Code to HTML in custom PHP pages in MyBB

Parsing BB Code to HTML is often required in PHP pages in MyBB. MyBB provides various types of BB code such as [img],[youtube],[font] and a lots of BB code but what if you are using MyBB integrated with a different project and you want to use those BB codes in your applications. One of the most difficult situations when you are parsing BB code to PHP in custom pages.

I have the solution for you all, it is very simple and you just need to call the below functions in your custom PHP code and that will enable you to use BB code in your PHP pages.
I have written the PHP code which you will need to copy.

[gist]https://gist.github.com/anonymous/e91030fb6d2f93b0f6aacc5fc3bdf0b8[/gist]

As you can see,in the first two lines we are calling the inbuilt parser present in MyBB.
After that we are setting the option present in parser function and allowing Mycode in MyBB.
Remember not to enable html in parser options as there has been some issues with MyBB using html in posts which might expose your forums to vulnerability.

Hope this helps you to parse bb code to html in custom php pages, let me know in case of any issues.

PHP in MyBB

@