Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin Tips & Tricks
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Remove Buttons from Editor with Plugin
RLShare
Join Date: Jun 2008
Posts: 499

 

Show Printable Version Email this Page Subscription
RLShare RLShare is offline 11-30-2008, 10:00 PM

I recently ran into a problem with a style I was creating where the editor in the userCP was just too wide for the style because of the userCP sidebar. I tried editing the CSS for the editor but there is a point where the editor will not get any smaller because of the buttons, and that was still too wide for the style I was working with. After a little searching through code I figured out how to remove some of the buttons to allow the editor to be smaller, its pretty simple.

First off, this will be done in a plug-in and the hook location will be 'editor_toolbar_start'. From this hook location you have access to a variable $forumid, if your making a post in a forum this variable will hold the forum ID, but if your using another section of the site such as creating a PM or editing your signature this variable will hold the values telling you that as well.

Possible values for $forumid:
'privatemessage'
'usernote'
'calendar'
'announcement'
'signature'
'visitormessage'
'groupmessage'
'picturecomment'
'nonforum'
Or it will be the forumID of the forum in which a post is being edited/created



Just like most areas of VB there is an array named 'show' that holds a list of true/false values of which things need to be shown. Such as which buttons to show in the editor.

Possible $show items:
$show['img_bbcode'] = image embed button
$show['font_bbcode'] = fonts drop down
$show['size_bbcode'] = font sizes drop down
$show['color_bbcode'] = font color drop down
$show['align_bbcode'] = align buttons
$show['list_bbcode'] =list buttons
$show['code_bbcode']= code button
$show['html_bbcode'] = html button
$show['php_bbcode'] = php button
$show['basic_bbcode'] = Bold/Italic/Underline all in one
$show['url_bbcode'] = embed link button
$show['quote_bbcode'] = quote button
$show['smiliebox'] = show the smilie box


Setting any of those values to false in a plugin with the hook location of 'editor_toolbar_start' will tell VB not to show the items in the editors toolbar.

Here is the plug-in I created to remove buttons on the PM/Edit Signature pages of my style to give you an example of how its done...

PHP Code:

switch($forumid)
{
case 
'privatemessage':
case 
'signature':
            
$show['font_bbcode']  = false
            
$show['basic_bbcode'] = false;        
            break;


And thats pretty much it, its really simple.
Attached Images
File Type: bmp sample.bmp (1,018.9 KB, 118 views)
Reply With Quote
  #2  
Old 06-23-2009, 08:48 AM
MarioN70 MarioN70 is offline
 
Join Date: Jun 2009
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks helped me a lot, if I want to hide a button in all editors that I have just put:
Code:
$ show [ 'size_bbcode'] = false;
:up:
Reply With Quote
  #3  
Old 10-18-2009, 12:46 PM
James Birkett James Birkett is offline
 
Join Date: Jun 2009
Posts: 633
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by MarioN70 View Post
Thanks helped me a lot, if I want to hide a button in all editors that I have just put:
Code:
$ show [ 'size_bbcode'] = false;
:up:
I wouldn't recommend putting spaces in between

PHP Code:
$show['size_bbcode'] = false
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:02 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.05752 seconds
  • Memory Usage 2,235KB
  • Queries Executed 19 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (2)bbcode_code
  • (2)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (1)postbit_attachment
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_attachment
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete