Implemented Allow custom BBCode

Paul B

XenForo moderator
Staff member
I know this has been discussed on various threads but as far as I am aware, the request hasn't been made directly to allow custom BBCode.

I have about 50 or so custom BBCodes in use on my site which are added easily via the ACP.
I would like to see the same functionality in XF as these codes are crucial to the functionality of my site.

Additionally, if there is a simple way of adding custom BB Code buttons to the TinyMCE editor then that would be extremely useful.
 
Upvote 69
This suggestion has been implemented. Votes are no longer accepted.
I would like to have a [tex] bbcode that allows us to use latex. We have our own mathtex engine that hooks up to vb so it would be great if we can do the same on XF.
 
I'd rather see [sql] and [css] before [somethinguncommon]
But having the ability to add your own, would fix that.
 
They're not in now, though they're not that hard.

I'm not sure I'd agree with them being used "often" though.

A lot of the English speaking forums use the [sup][/sup] and [sub][/sub] BBcodes fore things like dates, many others use it to add an
tag, to justify align text etc... There are many uses for BBcodes and many sued broadly, thus I think it is quite an important feature to allow custom BBcodes and make it easy to include icons in the editor so it makes life easy on the users to use and enjoy them :)
 
Make sure that when adding custom BB-Codes, adding them via the ACP also allows you to add ones that call their own PHP handlers at the same time (so a PHP-handled BB-Code can have its editor button). This was overlooked in vBulletin and required making dummy entries in the database so that we could have both an editor button and our own handler. However, the ACP-added BB-Codes were usually added later in the code than the PHP ones, overwriting them unless the mods that added them did so at a different hook location than everyone else. The BB-Code hook locations bbcode_fetch_tags and bbcode_create were not used by coders with any sense of consistency, and this resulted in a great number of conflicts.
 
I would like to second the requirement for tables, but have an alternative suggestion on how it could be implemented, based on vBulletin, for the majority of people who require simple tables.
I also require tables. I use a similar bbcode to Brogan in my phpbb system, it's basically html with square brackets. Problems: it's a pain to lay out the tables, you can't have line-breaks within the table bbcodes for example and it's hard to read due to the square brackets everywhere.

vBulletin have a superb table mod which uses a simple syntax.
The author just inserts | to mark the breaks between cells, and the system generates tables for you. So you'd type:
Code:
[table]cell 1 | cell 2 | final cell [/table]

An example of how the table looks once published is here.
The mod itself and documentation is here.
I once asked on stg if someone could port it to phpbb, but no bites.

I would still like the ability to have custom bbcodes, but think that the vBulletin method of doing tables should be a standard shipping feature of xenforo. It's just so neat.

I would use custom bbcodes for a few that I really need (also listed in more detail on my site):
  • wowhead tooltips (world of warcraft)
  • custom tooltips (tooltip for any purpose)
  • table of contents/anchor for longer technical posts
  • spoilers
  • custom quotes (fancy formatted quotes, for Blizzard authors).
 
There should be an option to disable the need for a closing tag per BB Code...

For example if I want to make an
bb code to do a horizontal line I should be able to just make something like:
or [hr="black"] instead of needing to close the tag like
or [hr="black"] which is necessary in forums like VB and such.
 
Agreed. Maybe it should be [hr/] for a self-closing tag instead of just
.

Another thing is custom bbcodes need the option to specify a php handler for processing instead of just a simple HTML replacement.
 
If the BBCodes have PHP handlers (or allow us to embed PHP variables) that'd be awesome...
Code:
[someCode="$username"]we can embed username of user viewing page here :)[/someCode]
 
Agreed. Maybe it should be [hr/] for a self-closing tag instead of just
.

Another thing is custom bbcodes need the option to specify a php handler for processing instead of just a simple HTML replacement.



Whatever is easier to implement... I know that makes more sense to people who know HTML already but maybe not so much for the rest of the world... personally I don't care so long as I don't need to close a tag that has no parameter.
 
Or even have more options, such as

[notice type="admin" background="black"]notice here[/notice]
This depends on how many parameters the BBCodes allow. In vB you're allowed 1 {option} and 1 {param}. I posted a thread on this ages ago but it didn't get a reply.
 
This depends on how many parameters the BBCodes allow. In vB you're allowed 1 {option} and 1 {param}. I posted a thread on this ages ago but it didn't get a reply.

Yeah, it would be good to have more parameters and be able to use if tags when setting the replacement.
 
This depends on how many parameters the BBCodes allow. In vB you're allowed 1 {option} and 1 {param}. I posted a thread on this ages ago but it didn't get a reply.

I believe phpbb allows multiple parameters when defining the tag, that would be ideal but honestly you can do a lot even with 1 param and 1 option, but this isn't a 'best way to implement bb code' thread, there was at least 1 of those already- this was just 1 extra suggestion should they allow custom bb codes at all, which honestly I can't believe they ever considered not having but after reading the earlier thread I wasn't so sure.
 
Only problem with non closing bbcode is when does the bbcode finish in the post? End of line? If for example I want to bold something, how would I indicate I only want to bold a couple of words rather than an entire paragraph?

Doesn't the current editor pretty much do what you want? Highlight the wordage you want in bbcode then click a button. Developers can add custom bbcode no doubt for additional stuff.
 
Only problem with non closing bbcode is when does the bbcode finish in the post? End of line? If for example I want to bold something, how would I indicate I only want to bold a couple of words rather than an entire paragraph
I think the self-closing tags would only be for things that don't contain content, like
, which would just insert a horizontal line.
 
Back
Top Bottom