1. 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

Discussion in 'XenForo Questions and Support' started by Mt.Rev, Jan 1, 2012.

  1. Mt.Rev

    Mt.Rev Member

    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?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    What are you trying to achieve?
     
  3. Mt.Rev

    Mt.Rev Member

    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. Mt.Rev

    Mt.Rev Member

    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?
     
  5. steel_curtain

    steel_curtain Well-Known Member

    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?
     
  6. Brogan

    Brogan XenForo Moderator Staff Member

    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. Mt.Rev

    Mt.Rev Member

    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.
     
  8. steel_curtain

    steel_curtain Well-Known Member

    Brogan is correct, to change that behavior you'll need to modify the core code.
     
  9. Mt.Rev

    Mt.Rev Member

    I don't mind editing the core codes, but you wouldn't happen to know which file it would be located in would you?
     
  10. steel_curtain

    steel_curtain Well-Known Member

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

    Code:
    'code' => array(
                    'parseCallback' => array($this, 'parseValidateTagCode'),
                    'stopSmilies' => true,
                    'stopLineBreakConversion' => true,
                    'trimLeadingLinesAfter' => 2,
                    'callback' => array($this, 'renderTagCode')
                ), 
     
    Mt.Rev likes this.
  11. Mt.Rev

    Mt.Rev Member

    This is exactly what I needed, thank you!
     
  12. Mt.Rev

    Mt.Rev Member

    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
     
  13. steel_curtain

    steel_curtain Well-Known Member

    I just tried what you did on my dev board and it worked fine creating a click-able URL.
     
  14. steel_curtain

    steel_curtain Well-Known Member

    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');
     
    Mt.Rev likes this.
  15. Mt.Rev

    Mt.Rev Member

    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.


    Wonderful -- now it works perfectly!
    I would never had been able to figure this out on my own.
    Thanks for assisting me with this!
     

Share This Page