In WordPress the editing section of both Posts and Pages uses TinyMCE. TinyMCE is a Javascript-based WYSIWYG editor that is used in a myriad of web applications and platforms. It works by converting HTML Textareas or other elements into an editor for the user. TinyMCE is very extensible by using plugins to extend the functionality from the default setup. There are quite a few commercial and free plugins available.
At my current job I am working on a project with a fellow WordPress fan, Joe Searcy, to convert from Adobe Contribute as our web-publishing platform to WordPress MU. There are a number of education folks out there using both single-player WordPress and WordPress MU to manage the website for their institutions.
One of the challenges as an institutional webmaster is having to reign in the users so that they will not create content that is tremendously ugly and makes your eyes bleed, yet you also have to give them a certain amount of editorial and visual control so that they don’t feel like their freedoms are being stepped on.
The Adobe Contribute engine with the use of the Contribute Publishing Server made this fairly easy with the role-based administration. As the webmaster, I could limit what things the users could do in regards to the styles that they can apply to the webpage content as they create and edit it.
While WordPress MU roles don’t give you the ability to turn off certain functions, such as changing the forecolor of text in a post or page, this is easily controlled by editing the configuration files that implement the TinyMCE editor.
The file is the same in a standard install of both single-player WordPress and WordPress MU. Here’s the directory tree showing the location of the file we need to edit:
In this file you need to look for a function entitled
function wp_tiny_mce
The section of code that handles the arrangement and appearance of the buttons will be around line 1221. Here’s the code from a unmodified WordPress MU that handles the TinyMCE buttons when “Showing the Kitchen Sink”. This code allows a user to change the forecolor (aka textcolor):
$mce_buttons_2 = apply_filters(‘mce_buttons_2′, array(‘formatselect’, ‘underline’, ‘justifyfull’, ‘forecolor’, ‘|’, ‘pastetext’, ‘pasteword’, ‘removeformat’, ‘|’, ‘media’, ‘charmap’, ‘|’, ‘outdent’, ‘indent’, ‘|’, ‘undo’, ‘redo’, ‘wp_help’ ));
This is the code for the second row of buttons. There are also variable for a third or fourth row of buttons, but they are not currently used.
If you wish to remove the ability to change the forecolor (aka textcolor) when creating or editing a post or page then make the code look like this by removing the text shown above in red:
$mce_buttons_2 = apply_filters(‘mce_buttons_2′, array(‘formatselect’, ‘underline’, ‘justifyfull’, ‘|’, ‘pastetext’, ‘pasteword’, ‘removeformat’, ‘|’, ‘media’, ‘charmap’, ‘|’, ‘outdent’, ‘indent’, ‘|’, ‘undo’, ‘redo’, ‘wp_help’ ));
If you notice, all the was removed was the array entry for forecolor. The same methodology can be applied the the other buttons that are shown in the TinyMCE bars.
Be careful what you remove in this file, since it controls the posting mechanism for both pages and posts. Also, the changes are not role-based, so the apply evenly to everyone, including administrators.