Back to Programming Articles

Adding New Buttons to the Editor Toolbar
by akanevsky 01 Oct 2005

Start by opening the editor_toolbar_on template.
That is the only template you need to edit, since in vBulletin this same template corresponds to both the standard editor and the wysiwig.

Find:
$vBeditTemplate[extrabuttons]

Before that row is where you should add buttons. However, you can add them anywhere you want if you know what you are doing.

Now about the buttons themselves:

Code:
<td><img src="$stylevar[imgdir_editor]/separator.gif" width="6" height="20" alt="" /></td>
Standard vBulletin Button Separator, does not do anything except separating buttons.

Code:
<td><div class="imagebutton" id="{$editorid}_cmd_wrap0_BBCODE"><img src="$stylevar[imgdir_editor]/YOURBUTTONIMAGE" width="21" height="20" alt="$vbphrase[YOURALTPHRASE]" /></div></td>
BBCODE - this part is what defines the bbcode to be insterted. Whatever you put instead of "BBCODE" goes into the square tag brackets.
YOURBUTTONIMAGE and YOURALTPHRASE are respectively the image and the descriptive phrase for that image.
You can also change the width of the image, but everything else should not be touched - esspecially the DIV ID (except the BBCODE part).

So far so good. But this does not allow a user to define a parameter for the bbcode tag.
To fix, open vbulletin_textedit.js located in clientscript folder, and find:

Code:
case 'PHP':
{
	this.apply_format('removeformat');
}
And below add:

Code:
case 'BBCODE':
{
	useoption = true;
}
Where BBCODE, of course, is the same bbcode you added earlier. Must be capitalized.

Done!

If anyone wants to add some information on how to make the buttons perform your own functions, do it.

Similar Mods

Thread and Post Buttons for the Editor Toolbar vBulletin 3.5 Add-ons

vblts.ru supports vBulletin®, 2022-2024