Fixed Strip out custom bbcode from preview

Alpha1

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:
Code:
[custom=something]Hello world[/custom]
The preview will show:
Code:
Hello world
If it is showing your custom BB code, something else is happening.

However, I think your implying something like:
Code:
[custom_media=youtube]oHg5SJYRHA0[/custom_media]
Showing:
Code:
oHg5SJYRHA0
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:
Code:
[IMGR="white]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/IMGR]
This indeed shows the vb attachment url in the snippet.

This one is a little weirder:
Code:
[imgl=white]http://global.fncstatic.com/static/managed/img/Entertainment/kinston%20shirts%20website%20660.jpg[/imgl][B]Title[/B]

[B]The clothing company recently debuted a new line, featuring jersey-like T-[URL='http://www.foxnews.com/entertainment/2013/08/29/cloth'][COLOR=#0066cc]shirts[/COLOR][/URL] and sweatshirts.[/B]

 [URL='http://www.foxnews.com/entertainment/2013/08/29/'][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='http://www.tmz.com/2013/08/29/'][COLOR=#0066cc]TMZ[/COLOR][/URL][COLOR=#0066cc][IMG]http://global.fncstatic.com/static/v/all/img/external-link.png[/IMG][/COLOR], they are determined to take legal action.
The snippet shows:
Code:
[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
Code:
[IMGR="white]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/IMGR]
into
Code:
[URL]https://site.com/forum/attachment.php?attachmentid=x&stc=1&d=y[/URL]
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:

upload_2016-2-3_13-59-15.webp
 
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]".
 
Back
Top Bottom