This is my method for phrasing BBCODE in the user profile field. I want to allow HTML to pass through aswell.
PHP Code:
if ($userinfo['field1'])
{
if (!is_object($bbcode_parser))
{
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
}
$userinfo['field1'] = $bbcode_parser->parse($userinfo['field1'],0, true);
}
I know that to phrase bbcode you do something like this
PHP Code:
require_once(DIR . '/includes/class_bbcode.php');
$parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$parsed_text = $parser->do_parse($text, $do_html, $do_smilies, $do_bbcode, $do_imgcode, $do_nl2br, $cachable);
The parameters for method do_parse() are:
- $text = Text to be parsed
- $do_html = Whether to allow HTML or not (Default = false)
- $do_smilies = Whether to parse smilies or not (Default = true)
- $do_bbcode = Whether to parse BB code (Default = true)
- $do_imgcode = Whether to parse the [img] BB code or not, independant of $do_bbcode (Default = true)
- $do_nl2br = Whether to automatically replace new lines with HTML line breaks or not (Default = true)
This should be set to false if you allow HTML.
- $cachable = Whether the post text is cachable or not (Default = false)
So I can use BBCODE in the fields fine, but if I use HTML it comes out screwed up.