XF 1.1 Remove [IMG] & [media] BBCodes from quoted post

Definitely requires code changes. This is the relevant code in XF:

XenForo_BbCode_Formatter_Base::renderTagQuote

This can be extended with the addon system, or you can modify the file directly.
 
To be more clear, it's only external images and media that get quoted - uploads already work correctly in terms of not being rendered in the quoted material....
 
To be more clear, it's only external images and media that get quoted - uploads already work correctly in terms of not being rendered in the quoted material....
That is correct. I wish that external media (IMG and media tags) had the same behavior as attach tags when quoted.
 
Has anyone gotten something like this to work yet?

Could this be used in some way, found in String.php?
Code:
/**
    * Strips BB code from a string
    *
    * @param string $string
    * @param boolean $stripQuote If true, contents from within quote tags are stripped
    *
    * @return string
    */
    public static function bbCodeStrip($string, $stripQuote = false)
    {
        /*$formatter = XenForo_BbCode_Formatter_Base::create('XenForo_BbCode_Formatter_BbCode_Strip', false);
        $formatter->setMaxQuoteDepth(0);
 
        $parser = new XenForo_BbCode_Parser($formatter);
        return $parser->render($string);*/
 
        // note: this is extremely primitive!
 
        if ($stripQuote)
        {
            $string = preg_replace('#\[(quote)[^\]]*\].*\[/\\1\]#siU', ' ', $string);
        }
 
        // replaces unviewable tags with a text representation
        $string = preg_replace('#\[(attach|media|img)[^\]]*\].*\[/\\1\]#siU', '[\\1]', $string);
 
        while ($string != ($newString = preg_replace('#\[([a-z0-9]+)(=[^\]]*)?\](.*)\[/\1\]#siU', '\3', $string)))
        {
            $string = $newString;
        }
 
        $string = str_replace('[*]', '', $string);
 
        return $string;
    }
 
It is very annoying.

For an interim solution, maybe rephrase "reply" to "quote". Conditioning members to use the quick reply. I never understood why it's called 'reply' when it quotes as well.

This

Quite misleading really and one of the first things I changed
 
I've also changed Reply to Quote, or rather Citera in Swedish, but that still doesn't stop my users from constantly clicking it and re-posting images and media. This gets very annoying, especially when the same Youtube video appears in several posts in a row.

But that "Strips BB code from a string" thing looks like it's meant to strip exactly what we want, but it also seems it's not implemented as a working option in Xenforo? Any comment on this from the developers?
 
Well, replacing this in Post.php:

Code:
. trim(XenForo_Helper_String::stripQuotes($post['message'], $maxQuoteDepth))

with:

Code:
. trim(XenForo_Helper_String::bbCodeStrip($post['message'], $maxQuoteDepth))

kind of works, but it leaves a [ img ] or [ media ] opening tag in the quoted post, and anything after the closing tag is also removed. o_O And of course, it also breaks the nested quotes removal.
 
Well, replacing this in Post.php:

Code:
. trim(XenForo_Helper_String::stripQuotes($post['message'], $maxQuoteDepth))

with:

Code:
. trim(XenForo_Helper_String::bbCodeStrip($post['message'], $maxQuoteDepth))

kind of works, but it leaves a [ img ] or [ media ] opening tag in the quoted post, and anything after the closing tag is also removed. o_O And of course, it also breaks the nested quotes removal.
The ideal solution would be for it to behave the same as attached/uploaded images, basically turn into a link instead of being embedded.
 
Finally found a decent solution for this issue. Add this to your EXTRA.css, and quoted images won't be visible in quotes:
Code:
/* Block images from quotes*/
.bbCodeBlock .bbCodeImage {
display: none !important;
}
Adapted from this:

http://xenforo.com/community/thread...hout-totally-disabling-sigs.2665/#post-233455
That's only a band-aid though. Wouldn't the images still be pulled from the server, using resources, they just aren't shown. Plus we do have cases where an image needs to be quoted, however they now wouldn't be visible period. Instead they should be converted to links.

Would you be interested in offering a few $ to have it developed?
 
Back
Top Bottom