PDA

View Full Version : Add custom bbcodes to quick reply


charlesr
09-20-2011, 12:11 PM
A while back I had some code in my showthread_quickreply that added in the custom buttons that appear in the advanced editor. It has stopped working in a recent version. I'm on 4.1.5

Anyone know how I can get this working again?
Here's the code I used to use.


<!-- Add custom BBCodes to quickreply box -->
<vb:if condition="$extrabuttons">
<li>
<vb:each from="extrabuttons" value="button">
<img src="{vb:raw button.buttonimage}" class="imagebutton" id="{vb:raw editorid}_cmd_wrap{vb:raw button.twoparams}_{vb:raw button.bbcodetag}" width="21" height="20" alt="{vb:rawphrase wrap_x_tags, {vb:raw button.tag}}" />
</vb:each>
</li>
</vb:if>
<!-- End Add custom BBCodes to quickreply box -->

Lynne
09-20-2011, 05:01 PM
hook location - editor_toolbar_filter
// for editor_toolbar_filter
if (THIS_SCRIPT == 'showthread')
$toolbar[] = array('BBCode1','BBCode2');

charlesr
09-21-2011, 10:15 AM
Thanks Lynne
Where your code says [BBCode1] am I meant to replace that with the "BB Code Tag Name"?
If so, then I have tried your suggestion, but nothing appears in the quick reply box. I'm on 4.1.5

Lynne
09-21-2011, 05:16 PM
You replace it with the BBCode Title.

charlesr
09-21-2011, 08:35 PM
Smart. That worked. A bit counter-intuitive, but all good thanks!

khalid
10-28-2011, 12:24 PM
hook location - editor_toolbar_filter
// for editor_toolbar_filter
if (THIS_SCRIPT == 'showthread')
$toolbar[] = array('BBCode1','BBCode2');

Thanks for this piece of code. It helped to insert text alignment in the quickreply.

Emeralda
02-11-2012, 08:55 PM
Sorry for posting in an old thread, but it seems it has the solution I'm looking for but I totally don't understand it. This allows adding custom bbcodes to the quick reply editor, right? Like Youtube, Spoiler, etc? Which of those codes should I add where?

charlesr
02-13-2012, 04:55 PM
Plugins / Add new plugin :)
Add Lynne's code and use hook location: editor_toolbar_filter
Where her code says BBCode1 instead use the BBCode title you assigned when making the BBCode.

Emeralda
02-13-2012, 05:31 PM
Rawr, worked great. I was using a solution posted here: https://vborg.vbsupport.ru/showthread.php?t=278422 but this one seperates the buttons and let me chose which bbcodes I want.

Now a question: http://prntscr.com/63wet <- would it be possible to make it so Strike-thru would be next to BIU buttons?
And how to do this for when you press edit button? http://prntscr.com/63whr

charlesr
02-14-2012, 07:30 AM
Not sure of the details, but to move the strikethru I'm guessing you'd have to do something similar with "cke_toolgroup" as the hook (install Firebug in Firefox to see what different vbulletin areas are called). If you get it to work, please post :)

Emeralda
02-14-2012, 11:27 AM
Something similar with the hook, meaning adding a plugin like before, but for different Hook Location? And uhm, I checked them, but there were no hooks starting with cke.

charlesr
07-12-2012, 10:25 AM
For reference, I changed the script slightly so it works on all editors except full editors (which already have the codes added by default). e.g.

// for editor_toolbar_filter hook location
if ($this->editor_type != "fe")
$toolbar[] = array('Spoiler Tag','YouTube','Vimeo','Gametrailer','Viddler','Fl ickr Slideshow','Strikethrough','Hide','Glow');