XF 1.3 Custom BB Codes

Some of you may have spotted this in a previous Have You Seen, but today we're going to look at XenForo 1.3's custom BB code support in detail.

At a high level, custom BB codes let you define BB codes to fit your site's needs. This allows you to give your users more options for mark up, without opening up arbitrary HTML and the various issues (security and otherwise) that come with that. A BB code may take an "option" parameter if needed, such as in [COLOR=option]...[/COLOR].

Basic Options

Let's look at the main BB code creation form. It's a biggie:

ss-2014-01-07_15-54-06.webp


This is just the "basic" fields. We'll get into the advanced stuff in a bit.

Many of these fields should be self explanatory. The title/description mostly relate to the help page, as well the example. Otherwise, you define how the tag is used -- if it takes an option or not (or optionally) and how the HTML replacement is done. If you wish to callback to a PHP file, you can.

Another option to note is the control over whether this BB code can be used in signatures. While custom BB codes don't have the full control of signature permissions like the standard codes, this can be used to limit certain codes in signatures to prevent abuse.

Advanced Options

Now, we have a bunch of other options which you don't necessarily need to adjust:

ss-2014-01-07_15-54-18.webp


On the advanced page, you can limit the option to expected formats. This is used in color, font, and size tags for example. You can also change the parsing rules within the tag, such as disabling smilies and other BB codes; you can see this in the [CODE] tag for example.

You can also add an icon to the editor to make it easier to add your code. If you've configured smilies, you'll be familiar with these options. (Note that this will just add a simple icon that when clicked makes it easy to insert the tag; more extensive integration would require custom JavaScript.)

Finally, in a few rare cases, you might want to use specific alternative replacements based on the context. Notably, this can be done in HTML emails (by default, the quote tag is different) or when rendering to pure text (quotes and images are different, amongst other things).

Add-ons, Importing, and Exporting

You might have noticed the option to select an add-on on the BB code creation form. Like various other types of content, you can assign a custom BB code to an add-on and it will be created when the add-on is installed and remove when it's uninstalled. (This is only available in debug mode.)

However, like smilies, a selection of BB codes can also be individually exported and then imported, independent of the add-on system. This should make sharing BB codes (or BB code sets) easier. (Note that BB codes that are attached to an add-on cannot be exported independent of the add-on.)



While this is certainly not a revolutionary feature, we're sure this will give admins more control over their site and allow you and your users to format messages the way you want.
 
I'm not aware of any reason why a bb code add-on wouldn't work with other areas of XF.

There may be reasons why specific BB Codes don't work for specific reasons with certain content, but I'd find it hard to believe that a custom bb code manager add-on wouldn't work with anywhere you can input bb code.
 
I'm talking about BB Code Manager add-ons. They work in Resource Manager.

But it is BB Code dependent, as I was saying. There may be reasons why specific BB codes won't work in all areas. It's purely down to the developer of that BB Code to build it in such a way that works everywhere.
 
I'm talking about BB Code Manager add-ons. They work in Resource Manager.

But it is BB Code dependent, as I was saying. There may be reasons why specific BB codes won't work in all areas. It's purely down to the developer of that BB Code to build it in such a way that works everywhere.
the problem i say that to him but no answer from oct/2013 ^_^
http://xenforo.com/community/resour...mpatible.1116/reviews?resource_rating_id=6461

and i cant contact with him as he limit the users who see his profile ><"

and i wait the bbcode in 1.3 just to make a bbcode tabs my self >_<
 
Any chance we'll be able to create a drop-down icon with a list of pre-defined parameters (like the drop-down for the font selector)?
With 1.3 getting closer, any of the staff guys know the answer to this one? With the new editor using drop-down lists of misc. stuff like the alignment, insert (aka: additional codes), etc., I have something in mind for a custom bb code that would allow a pre-defined parameter from a drop-down list.
 
Like other non-techs I have little understanding of how I can use this to improve my Forum members experiences. Can it be use to wrap text around images - a function I believe should be standard and easily used in a Forums. Why should Forums have such primitive formatting that a image has to stand out apart from the text?
 
Like other non-techs I have little understanding of how I can use this to improve my Forum members experiences. Can it be use to wrap text around images - a function I believe should be standard and easily used in a Forums. Why should Forums have such primitive formatting that a image has to stand out apart from the text?
There's one available in this addon (bimg) with other editing options as well:
http://xenforo.com/community/resources/bbcodes-buttons-manager-advanced-bb-codes-pack.1428/

The XenForo default image Bb Code is not primitive. With its JavaScript it optimizes the display if the image no matter the size of the container (a post, a page, etc.) or the screen of the device. It's very flexible. The image Bb Code logic of the above addon is not the same. It is use to create a custom layout of a page, mostly on large screens (a float option doesn't make any sense on a mobile device). It's a way to reproduce what we can see in "traditional media".
 
Top Bottom