• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Censoring a BB Code

#1
I'm trying to replace the BB Code by using the censor option, but it doesn't replace it.

Code:
Replace [code] with [quote]
Since the word replacement option doesn't effect BB Codes, is there another way I can do this?
 
#3
I want to prevent people from using
Code:
 [code][/code ]
and if able to replace it with
Code:
[quote][/quote]

Or maybe a better way to explain it would be have the [code.] tag to do the same thing as how a [quote.] tag would do.

Where should I start looking to get this done?
 
#4
Or is there a way to have the "Code" BBCode turn URL in to actual click-able links?

I tired to copy and paste the "quote" codes and replaced it with the "code", but it seems like it only changed the style of it.
I must be looking in the wrong place. Can anyone point me to the right direction please?
 

steel_curtain

Well-known member
#5
If you type any URL into the editor it already makes them into click-able links. Is there something more you're trying to do with the links besides that?
 

Brogan

XenForo moderator
Staff member
#6
You will have to edit the core files to remove or change the code functionality.

You will need an add-on to do that.
 
#7
Yes, when people use the "code" BBCode, it doesn't create a click-able URL

Example:

Code:
http://xenforo.com
I would like the above to be a click-able link even when the BBCode is being used.

Or if it would be easier, to have the "Code" to act the same as "Quote" BBCode.
 

steel_curtain

Well-known member
#10
Library -> XenForo -> BbCode -> Formatter -> Base.php

Code:
'code' => array(
                'parseCallback' => array($this, 'parseValidateTagCode'),
                'stopSmilies' => true,
                'stopLineBreakConversion' => true,
                'trimLeadingLinesAfter' => 2,
                'callback' => array($this, 'renderTagCode')
            ),
 
#12
Actually, it didn't work the way I expected it to.

I replaced the:

Code:
            'code' => array(
                'parseCallback' => array($this, 'parseValidateTagCode'),
                'stopSmilies' => true,
                'stopLineBreakConversion' => true,
                'trimLeadingLinesAfter' => 2,
                'callback' => array($this, 'renderTagCode')
            ),
With:

Code:
            'code' => array(
                'trimLeadingLinesAfter' => 2,
                'callback' => array($this, 'renderTagQuote')
            ),
This is the code from "quotes", but the URL still isn't click-able
 

steel_curtain

Well-known member
#14
Whoops... I did one more step. I took out the 'code' portion in this array as well.

Library -> XenForo -> BbCode -> Formatter -> BbCode -> AutoLink.php

Code:
protected $_disableAutoLink = array('url', 'email', 'img', 'code', 'php', 'html', 'plain');
 
#15
I just tried what you did on my dev board and it worked fine creating a click-able URL.
It was a bit weird because when i first all I did was comment out
Code:
'parseCallback' => array($this, 'parseValidateTagCode'),
and then refreshed the post page and the link was click-able.
But when I tired it again, it wasn't click-able anymore.


Whoops... I did one more step. I took out the 'code' portion in this array as well.
Wonderful -- now it works perfectly!
I would never had been able to figure this out on my own.
Thanks for assisting me with this!