<div>
Adding New Buttons to the Editor Toolbar
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:
<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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.
<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP 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> [img]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-8.jpg[/img][img]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-9.jpg[/img][img]file:///C:/DOCUME%7E1/ADMINI%7E1/LOCALS%7E1/Temp/moz-screenshot-10.jpg[/img]
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:
<div style="margin: 5px 10px;"> <div class="smallfont" style="margin-bottom: 2px;">Code:
PHP Code:
case 'PHP':
{
this.apply_format('removeformat');
}
And below add:
<div style="margin: 5px 10px;"> Code:
PHP Code:
case 'BBCODE':
{
useoption = true;
}
Where BBCODE, of course, is the same bbcode you added earlier. Must be capitalized.
Done!