The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Please help. Need to parse bbcode in a user profile field and pass it to a template.
I posted a few days ago about this, but a member told me about user profile fields. Very helpful. I've managed to get the profile field to show in the template that I want (member info), however, when I add BBcode or html to the profile field, vbulletin just shows the code in the browser and doesn't parse it.
I know the dangers of html in vbulletin. I'm just trying things to see what works and what doesn't. So what I need to do is this... I need to be able to show my profile field in the template but have it be parsed. I figure a plugin is needed, but I can't seem to get the code to work. I've read mod about parsing bbcode. 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); I know the template, plugin, and vbulletin "all become one" after the server works, but I can't grasp the concept well. Please help. |
#2
|
||||
|
||||
I wrote a mod where I needed to process the bbcode (View all your social group messages) and I copied/modified a function to parse the bbcode:
PHP Code:
PHP Code:
|
#3
|
|||
|
|||
Ok I tried to do what you said. I've got a new profile field (field65) that I've managed to display once on my page using an eval statement, but when I try the following code, I get nothing. I've got my variable $mypage inserted into the MEMBERINFO template. I've been playing with this for about an hour now. I must be off to work. Any ideas?
Code:
function process_message_preview($message) { global $vbulletin, $vbphrase, $stylevar, $show; require_once(DIR . '/includes/class_bbcode.php'); $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $previewhtml = ''; if ($previewmessage = $bbcode_parser->parse($message['pagetext'], 'socialmessage', $message['disablesmilies'] ? 0 : 1)) { $previewhtml = $previewmessage; } return $previewhtml; } process_message_preview($message); $mypage = process_message_preview($vbulletin->userinfo['field65']); eval MEMBERINFO; |
#4
|
||||
|
||||
That is not how you eval a template. Take a look in a page like member.php and you'll see these last lines:
PHP Code:
|
#5
|
|||
|
|||
I got it working! Awesome. Now all I have to do is create a bunch of bbcode tags for html elements like table td tr etc!
heres what I ended up with. Code:
function process_message_preview($message) { global $vbulletin, $vbphrase, $stylevar, $show; require_once(DIR . '/includes/class_bbcode.php'); $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $previewhtml = ''; if ($previewmessage = $bbcode_parser->parse($message, 'socialmessage', $message['disablesmilies'] ? 0 : 1)) { $previewhtml = $previewmessage; } return $previewhtml; } $mypage = process_message_preview($vbulletin->userinfo['field65']); eval('$mypage = "' . fetch_template('user_custompage') . '";'); |
#6
|
||||
|
||||
Great! :up:
|
#7
|
|||
|
|||
I had posted something saying I was going to go look at class_bbcode.php. I did, and have changed my code to the following...
Code:
function process_message_preview($message) { global $vbulletin, $vbphrase, $stylevar, $show; require_once(DIR . '/includes/class_bbcode.php'); $bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list()); $previewhtml = ''; if ($previewmessage = $bbcode_parser->do_parse($message, $do_html = true, $do_smilies = true, $do_bbcode = true, $do_imgcode = true, $do_nl2br = true, $cachable = false)) { $previewhtml = $previewmessage; } $mypage = process_message_preview($vbulletin->userinfo['field65']); eval('$mypage = "' . fetch_template('user_custompage') . '";'); Here is my profile field code. PHP Code:
|
#8
|
||||
|
||||
<table> is html not bbcode. You would have to parse it for html otherwise it will treat the < and > as text characters and turn them into < and $gt; in the page source.
|
#9
|
|||
|
|||
Risking posting before googling, is there an HTML parse function in vbulletin?
|
#10
|
||||
|
||||
Probably. You can look in the API for one (link under Quick Links)
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|