Fixed Strip out custom bbcode from preview


Well-known member
XF strips out bbcodes from previews, but it does not strip out custom bbcodes. This becomes an issue if you have a lot of custom bbcodes at the start of a message. Tens of thousands of my threads start with a custom bbcode. So if you hove over the thread title then you see a bunch of code. This looks like there is a bug to the end user.

This also affects previews displayed by addons like AMS & showcase.
Do you mean when previewing before posting or previewing the thread content from the thread list (the pop up when you hover the thread title)?

Also, this almost seems like a bug.
It's also a problem in RSS feeds, actually. I've just moved a forum from vB to XF where we use a custom image code with left or right alignment at the beginning of every news post and we were having the same problem there.
I was going to move this to bugs, but I think your explanation may be more specific than what you're implying.

Custom codes are stripped out of the preview like most of the other BB codes. If I have:
[custom=something]Hello world[/custom]
The preview will show:
Hello world
If it is showing your custom BB code, something else is happening.

However, I think your implying something like:
Whereas the default media tag (and default img and attach tags) replace with placeholders to indicate that it's rich content content.

So I think what you're after is an BB code option to say that the tag doesn't produce text-only readable output.

It's also a problem in RSS feeds, actually. I've just moved a forum from vB to XF where we use a custom image code with left or right alignment at the beginning of every news post and we were having the same problem there.
The RSS feed renders custom BB code to HTML without issue. It sounds to me like you haven't actually defined the custom BB code you need.
I've done it a bit differently than previously in vB now (where this was an issue); I installed Brogan's image float left/right mod and that indeed renders in RSS. However, text doesn't wrap around images so it looks off but I don't suppose there's any way to make that look proper in RSS? If not, I'd welcome the option to not show specific tags in RSS. E.g. we've got news image thumbnails in FLOAT_LEFT/FLOAT_RIGHT and IMG. If we can't get the text to wrap around the news images, it'd probably be better to exclude the images from the feed altogether.

(To explain, I'm in the middle of post-migration setting up everything again on a XF the way we had it on a vB big board.)
It's probably best to post anything further about your issue in a new thread as I don't think it's related to what's being discussion in this suggestion. I'm actually not clear specifically where your issue is because when you say "RSS feeds", I assume you're referring to RSS feed generation which outputs HTML and thus would generate whatever HTML your tag is generating. If you want to discuss this further, I'd recommend posting a thread in the support forum, likely with screenshots or snippets to demo specifically what you're referring to.
I have many thousands of threads that start with this bbcode:
This indeed shows the vb attachment url in the snippet.

This one is a little weirder:

[B]The clothing company recently debuted a new line, featuring jersey-like T-[URL=''][COLOR=#0066cc]shirts[/COLOR][/URL] and sweatshirts.[/B]

 [URL=''][COLOR=#0066cc]link title[/COLOR][/URL], The shirts cost $58; sweatshirts cost $98. The tagline reads: “a quote here.”

Reps could not immediately be reached for comment, but according to [URL=''][COLOR=#0066cc]TMZ[/COLOR][/URL][COLOR=#0066cc][IMG][/IMG][/COLOR], they are determined to take legal action.
The snippet shows:
[img][/COLOR], they are determined to take legal action.
I'll need to take a look at that second snippet to confirm. The first snippet is broken BB code in the eyes of XenForo though -- it has an unmatched " in the parameter. The BB code stripping process for the preview is mostly designed to be "quick and dirty" rather than 100% accurate, which means there are situations where it can parse differently. It may be worth us not using that method here though.
This is indeed fixed as the IMGL bbcode ignored in the preview snippet. But instead it turns
And fully shows this in the preview snippet.
This will be down to how the custom BB code is configured.

In the preview snippet the custom BB code will render based on the content of this field:

This field is empty. How can I avoid that the preview snippet shows anything in the bbcode tag?
Is there anything that I can add to this field to accomplish this?
As an example, this is the kind of use case which leads us to render the BB code out as, e.g. [ATTACH], [IMG] or [MEDIA] in scenarios such as text snippets.

You can put anything here, and it will render that. In this case, it is left empty, "the tag will effectively be ignored, leaving only the text inside it". As the text is a URL it is auto linked to a URL tag. If this was a core XF BB code we would likely render it simply as "[IMGR]".
Top Bottom