Jump to content

BBCode in Comments


Graeme S.

Recommended Posts

  • 11 months later...

It's deliberately not done. The idea of profile comments was to be as simple as possible so as to not detract users from the actual forums.



How would allowing smilies in the guestbook, detract from the forums? That answer really doesn't make any sense at all. You're basically saying, users will now use the forum more, because they can't post smilies in the guestbook. Urghhh OK.

I think the answer is more likely due to the fact that while searching for inspiration for the comments system, you decided Facebook was the site to model but rather than just taking their best bits, you copied it almost exactly. Bad move IMO.
Link to comment
Share on other sites

Well, while I didn't work here when the feature was added, the suggestion we got was probably "you should add profile comments, like Facebook!" so probably yes ;)

It's a really simple change though, leave it with me and I'll post some instructions later :)

Link to comment
Share on other sites

admin/applications/members/sources/classes/comments.php

Find:

$comment = IPSText::truncate( $comment, 400 ); $comment = preg_replace( "#(\r\n|\r|\n|<br />|<br>){1,}#s", "\n", $comment ); $comment = trim( IPSText::getTextClass('bbcode')->stripBadWords( $comment ) );







Replace with:

IPSText::getTextClass('bbcode')->parse_html = 0; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; $comment = IPSText::getTextClass('bbcode')->preDbParse( IPSText::truncate( $comment, 400 ) );










Find:

$comments[] = $row;





Add above:

IPSText::getTextClass('bbcode')->parse_html = 0; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id']; IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others']; $row['comment'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment'] );









Link to comment
Share on other sites

Facebook wasn't quite as big and popular as it is now when that feature was added. I don't think Facebook provided any real inspiration for the profile comments feature. We simply wanted a "light weight" parser there instead of full-on parsing of every tag. In fact, at first, no parsing was done, but people requested we add at least b/i/u support, so we did.

Link to comment
Share on other sites


admin/applications/members/sources/classes/comments.php



Find:



		$comment = IPSText::truncate( $comment, 400 );

		$comment = preg_replace( "#(\r\n|\r|\n|<br />|<br>){1,}#s", "\n", $comment );

		$comment = trim( IPSText::getTextClass('bbcode')->stripBadWords( $comment ) );

Replace with:


		IPSText::getTextClass('bbcode')->parse_html		= 0;

		IPSText::getTextClass('bbcode')->parse_nl2br	= 1;

		IPSText::getTextClass('bbcode')->parse_smilies	= 1;

		IPSText::getTextClass('bbcode')->parse_bbcode	= 1;

		$comment = IPSText::getTextClass('bbcode')->preDbParse( IPSText::truncate( $comment, 400 ) );

Find:


$comments[] = $row;

Add above:


			IPSText::getTextClass('bbcode')->parse_html 				= 0;

			IPSText::getTextClass('bbcode')->parse_nl2br				= 1;

			IPSText::getTextClass('bbcode')->parse_bbcode				= 1;

			IPSText::getTextClass('bbcode')->parse_smilies				= 1;

			IPSText::getTextClass( 'bbcode' )->parsing_mgroup			= $row['member_group_id'];

			IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others	= $row['mgroup_others'];

			$row['comment']	= IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment'] );




Thanks for this. I had already modded my IPB to do this - I was just pushing for a setting, so we don't have to modify the IPB source code in the future :P
Link to comment
Share on other sites


admin/applications/members/sources/classes/comments.php



Find:



		$comment = IPSText::truncate( $comment, 400 );

		$comment = preg_replace( "#(\r\n|\r|\n|<br />|<br>){1,}#s", "\n", $comment );

		$comment = trim( IPSText::getTextClass('bbcode')->stripBadWords( $comment ) );

Replace with:


		IPSText::getTextClass('bbcode')->parse_html		= 0;

		IPSText::getTextClass('bbcode')->parse_nl2br	= 1;

		IPSText::getTextClass('bbcode')->parse_smilies	= 1;

		IPSText::getTextClass('bbcode')->parse_bbcode	= 1;

		$comment = IPSText::getTextClass('bbcode')->preDbParse( IPSText::truncate( $comment, 400 ) );

Find:


$comments[] = $row;

Add above:


			IPSText::getTextClass('bbcode')->parse_html 				= 0;

			IPSText::getTextClass('bbcode')->parse_nl2br				= 1;

			IPSText::getTextClass('bbcode')->parse_bbcode				= 1;

			IPSText::getTextClass('bbcode')->parse_smilies				= 1;

			IPSText::getTextClass( 'bbcode' )->parsing_mgroup			= $row['member_group_id'];

			IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others	= $row['mgroup_others'];

			$row['comment']	= IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment'] );

I'm currently using this code, however BBCode parsing doesn't work (urls, images, etc). Even though parse_bbcode is set to 1, it has no effect. I double checked the DB and its definitely not getting parsed. it simply shows up as text, like:

[/img]


[img]		



and doesn't parse it at all. Turning off parse_smilies, however, stops smilies from parsing, as it should. I just can't get it to parse BBCode. Any suggestions?

Link to comment
Share on other sites

Sorry I missed this :)

There is an error in the second edit I posted, it should be:

IPSText::getTextClass('bbcode')->parse_html = 0; IPSText::getTextClass('bbcode')->parse_nl2br = 1; IPSText::getTextClass('bbcode')->parse_bbcode = 1; IPSText::getTextClass('bbcode')->parse_smilies = 1; IPSText::getTextClass( 'bbcode' )->parsing_mgroup = $row['member_group_id']; IPSText::getTextClass( 'bbcode' )->parsing_mgroup_others = $row['mgroup_others']; $row['comment_content'] = IPSText::getTextClass('bbcode')->preDisplayParse( $row['comment_content'] );




Link to comment
Share on other sites

  • 2 weeks later...
Guest CallieJo

Thanks for this. Not parsing images and smilies in the profile comments was a big dent in our move from vb. Especially when it left a mess of bbcode in the comments from the import. Now all is great thanks to the help in this thread. Thanks!

Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...
  • 1 year later...

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...