Making Simple Tags work with WordPress 2.9

For some of you that have just upgraded to the shiny new WordPress 2.9 release, you may have noticed a nasty little message that states that Simple Tags won’t work with the version of WordPress that you now have installed.

The issue at hand here is that the code for the plug-in contains a hard-coded check for the version number to ensure compatibility. It doesn’t appear on the surface that there will be any issues with this plug-in and the new WP code. Continue reading

Modifying the TinyCME in WordPress

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:

directory_tree_tinyMCE

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.

Migrating WordPress

As some of you might have noticed, I have just recently moved my WordPress installation into a subdirectory of arfore.com.

There are several reasons for this, the main one being that I would like for my blog to become a component of my website rather than the blog being the entire site.

Moving the WordPress installation itself was quite simple, and there are many pages out there describing the process as well as the pitfalls of doing it incorrectly, so I won’t repeat them here.

What was less easy to find was the proper changes to put in the .htaccess file to ensure that any existing links would get redirected to the proper location in the moved WordPress setup.

I have my permalinks configured to create a URL like follows:

http://arfore.com/blog/2008/10/12/foo-bar-baz/

In order to add the subdirectory blog to the front of the URL I used the following rule in my .htaccess file:

RewriteRule ^([0-9](.*))$ http://arfore.com/blog/$1 [R=301,L]

Similarly, to redirect the categories I used the following:

RewriteRule ^category/(.*)$ http://arfore.com/blog/category/$1 [R=301,L]

Now this may not be the most correct method to accomplish the goal, so if it needs correcting by all means let me know.