Page 1 of 1

Parse the replacement text for a censored word.

Posted: Sun Jan 31, 2010 3:35 am
by Blue Blood
I'm in need of a mod to parse the replacement text for a censored word.
In phpBB3 if you set the replacement text with any BBCode with will display as is.

This worked in phpBB2....

If you don't under stand what I mean read this
http://www.phpbb.com/community/viewtopi ... &t=1962375

Thanks

Re: Parse the replacement text for a censored word.

Posted: Sun Jan 31, 2010 10:22 pm
by Skinny Vinny
I don't know that you're going to find a 'reasonable' way to do this in phpbb3. The bbcode in post and sigs have identifiers. It's not as simple as calling a function/method.

Out of the box, any html you enter into the word censor in html character encoded and displays as the characters, does not render. This is a very easy fix.

As of 3.0.6
Open cache.php, at or around line 96, find:

Code: Select all

                $censors['replace'][] = $row['replacement'];  
Replace with :

Code: Select all

                $censors['replace'][] = html_entity_decode($row['replacement']);  

Now here's the problem:
Yes, your html in the replacement text will now render.
This will also render within linked topic titles, which is going to cause a mess. Can see problems with censors within post bbcode, etc. Most of the time, this should just create validation issues, which so long as they don't interfere with your users experience... who cares. But, depending on how you're using this, I could see potential to create a mess.

The simple fix for topic/subject links is to simply add strip_tags when the censor_text function is called on them. I would imagine that there are a ton of places that would need to be updated for this. I may look into it more later.

Re: Parse the replacement text for a censored word.

Posted: Sun Jan 31, 2010 11:03 pm
by Skinny Vinny
This is still rolling around in the back of my head. lol
There are just so many potential uses.

There are a few horrible uses I can think of, too...
but to each their own I suppose.

I absolutely hate the idea of editing so much to resolve the topic titles issue. I really only see one way to avoid it.

Have a feeling I'm going to be back on this one later tonight.
I should have a reasonable solution together this week.

Re: Parse the replacement text for a censored word.

Posted: Fri Feb 12, 2010 6:53 am
by Blue Blood
Cool thanks man...
I hope you or someone can make a mod!!! :)

Re: Parse the replacement text for a censored word.

Posted: Tue Aug 24, 2010 5:53 am
by Blue Blood
Has anyone found a solution!!
PLEASE!!!!

Re: Parse the replacement text for a censored word.

Posted: Sat Apr 11, 2015 3:05 pm
by Movie
Any updates on this?

Having the ability for common words that newbies needed more details on so they could simply click on the word they did not understand and the link took them to more details on the word or term they did not understand would be a time saver and educational.

Re: Parse the replacement text for a censored word.

Posted: Fri Apr 17, 2015 8:06 pm
by ViolaF

Re: Parse the replacement text for a censored word.

Posted: Sat Apr 18, 2015 1:27 am
by FoulFoot