View Full Version : BBCode Parsing Question
House_of_Crazed
10-25-2004, 07:23 AM
How would one go and make "Custom Profile Fields" be parsed by bbcode?
I've been studying the code and can't seem to grasp it.
So ideas will be appreciated. :)
Xenon
10-25-2004, 04:23 PM
well, you have to parse em where the output is generated, so fetch_postbit function as well as everywhere else you can view them (for example profile)
House_of_Crazed
10-25-2004, 06:56 PM
Hmmm...
I'm not sure if I understand what you mean.
Can you further clarify what you're saying? :) lol
Xenon
10-25-2004, 07:03 PM
Well, you have to use the parse_bbcode function on the custom profile fields on every instance where it appears as an output.
So to give an example.
Here on vb.org we're showing the realname of a user in the postbit, so if i want to allow bbcode parsing there, i would have to manipulate fetch_postbit().
Also the realname is shown on a members profile, so a parse_bbcode call would be needed there as well :)
House_of_Crazed
10-25-2004, 07:20 PM
Wow, call me stupid but you lost me. :(
*laughs*
No worries, I'm stupid anyway.
I'm looking at member.php (at least I hope that's the right file) and I see between lines 484 to 530 (roughly)... I don't see "fetch_postbit". Or am I blind?? :(
Thing is, I want the bbcode to be parsed on a member's profile, not in postbit. LOL Because I have a "Biography" field that my members can fill in. They've asked for bbcode parsing in the field and I was like, "Why not, that can't hurt anyone"
Xenon
10-25-2004, 07:29 PM
you're looking for the wron thing ;)
fetch_postbit isn't in member.php
if you just want it to show up in the profile, member.php is the correct file
actually before that line:
eval('$customfields .= "' . fetch_template('memberinfo_customfields') . '";');
add a if fieldid == your id, do parse_bbcode($field[content])
(just pseudocode, not the correct implementation ;)
House_of_Crazed
10-25-2004, 07:51 PM
Bahh....
You're making me work, aren't you?? LOL
*goes back to crying*
I know it just has to be a one-liner.
Xenon
10-25-2004, 07:54 PM
Yes i am :)
I think it's the best way to teach someone to help yourself ;)
I gave you enough tips right now. Just try around, i'm sure you'll find it out, and if not, then i will post the solution tomorrow :)
House_of_Crazed
10-25-2004, 07:59 PM
lol
Okay then!!
*goes and takes 2 aspirins* Let's see here... LOL
Xenon
10-26-2004, 04:32 PM
*gg*
So how're you doing?
House_of_Crazed
10-26-2004, 06:06 PM
:(
I'm defintely stupid.
Gimme :( lol ...
I spent like 2 hours on this trying different variables of the code, and just gave up, lol ...
:(
Xenon
10-26-2004, 06:13 PM
ok, so let's give it a try then :)
quite before the line i posted above put this:
if ($profilefield['profilefieldid'] == xx)
{
require_once('./includes/functions_bbcodeparse.php');
$profilefield['value'] = parse_bbcode2($profilefield['value'], 0, 1, 1, 1);
}
that should be all, just change the xx into the id of your profilefield which needs the parsing :)
House_of_Crazed
10-26-2004, 07:14 PM
OMG... I was defintely close then...
I didn't do the $profilefield['value'] line. :(
I knew it had to be nested somehow. *sigh*...
House_of_Crazed
10-26-2004, 07:17 PM
this is what I had, LOL
if ($profilefieldid == '1')
{
require_once('./includes/functions_bbcodeparse.php');
parse_bbcode($profilefield['value']);
}
At least I was almost there... *laughs*... But after 2 hours of trying, I just had to stop trying.
Xenon
10-26-2004, 08:24 PM
:)
well, as long as you learnt something, it was worth the time, don't you think?
House_of_Crazed
10-26-2004, 09:11 PM
*nods* lol
PHP isn't my thing, but am always willing to learn, lol ...
House_of_Crazed
10-26-2004, 11:19 PM
Humm...
LOL
We broke something :(
Apparently the biography field is spitting out <br />'s as well which is HTML code.
Here's an example from my biography field...
dfasdfasdfasf<br />asdfsadf<br />asdfsadf<br /><br />sdaasdfwewqef<br /><br />wefwefwef<br />wefwqefwef<br />wef<br />wqefwefwqef<br /><br />wqefwefqwef<br />wqef<br />weqf<br />wqef<br />qwef
*laughs* *shrugs*
Xenon
10-27-2004, 12:10 PM
change the 0 in my code into a 1.
as the htmlpart is already done before, two times htmlspecialchars.. will produce that bug then ;)
Hades-1
07-08-2005, 02:26 PM
hey xeon, you rock dude, been looking for this forever, just tried it and its perfecto!!!!
noonespecial
11-11-2005, 07:27 PM
Is there anyway to do this in vb 3.5? I was hoping this would work, it doesn't.
if ($profilefield['profilefieldid'] == 27)
{
require_once(DIR . '/includes/class_bbcode.php');
$bbcode_parser =& new vB_BbCodeParser($vbulletin, fetch_tag_list());
$profilefield['value'] = $bbcode_parser->parse($profilefield['value'], 0, true);
}
Exitilus
12-22-2005, 04:05 AM
Bump. Ditto *L* Of course it was one of my web guys who started this hehe :)
Exitilus
12-24-2005, 02:37 AM
Anyone have any idea how i can do this? I'd like too get this working on my site for the Biographies / About Me
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.