A few weeks ago I published a post of my favorite Wordpress plugins. In that list I included a plugin called EditorMonkey. Unfortunately, the plugin turned out to be a lemon and was a real pain to remove. When I first tried to remove it by deactivating the plugin from the Wordpress admin panel, I could not restore the Wordpress TinyMCE editor and what remained was a meager toolbar that left me handcoding my posts in pure HTML. So, after scouring the internet blogs I was able to piece together a solution to remove the plugin and return Wordpress back to it’s original state. Enjoy!
- Deactivate the plugin from within the Wordpress admin panel.
- Go to your database, and search for the wp_usermeta table. Caution: be very careful making changes here! You can end up corrupting your entire site if you aren’t paying attention. Make sure to backup your site before proceeding.
- Browse within the wp_usermeta table and delete any entries that start with an em_ .
- Next, within the same table, go to the rich_editing field and set the value from false to true.
- Delete the plugin from your wp-content/plugins directory.
- Voila! EditorMonkey is gone and the default TinyMCE editor has returned.
I finally figured out how to hack the user roles in wordpress to control exactly what they could and couldn't do. Although the default user roles were adequate, it didn't provide the type of control I needed. Wordpress 2.0 assigns user roles with an associated user level for backwards compatibility. These access levels are labeled 0-10; 10 being the highest access level granted.
So, exactly how do you customize these default user roles? The first thing to do is go to http://codex.wordpress.org/Roles_and_Capabilities and read the user level vs. role conversion details and brush up on the different user roles.
Next, let's familiarize ourselves with exactly what happens when a user logs in to Wordpress. This is a very obtuse and basic overview of the process; please don't hold me accountable for details. When a user logs in they are redirected to the admin.php page. Once they enter their id and password admin.php calls other php files to check the user roles then calls menu.php to build the admin page and menu. The menu is built based on access levels (0-10). So if your profile is set as a level 7 and the "Write Page" button is set with a level 8; you can't see it. In a nutshell, we are going to alter this menu.php document to give us the custom access we want. Let's get busy and start coding!
Step 1: Go to your Wordpress root, then \wp-admin\menu.php. Open it in the editor of your choice.
Step 2: Now edit any menu item or sub-menu item according to different user levels. See below for my example.
Example: I had a user setup as with the role of "Editor", but, due to a custom Wordpress build I did not want the user creating, editing, or managing pages or categories. So I found the items I wanted to edit…
- $submenu['post.php'][10] = array(__('Write Page'), ‘edit_pages', ‘page-new.php');
- $submenu['edit.php'][15] = array(__('Categories'), ‘manage_categories', ‘categories.php')
Since the default Editor role has an access level of 7, I needed to change the level of these sub-menu items to 8 by adding the following lines of code:
- $submenu['post.php'][10] = array(__('Write Page'), 8, ‘edit_pages', ‘page-new.php');
- $submenu['edit.php'][15] = array(__('Categories'), 8, ‘manage_categories', ‘categories.php')
Save the file and copy it over ther old and now when the user logs in they no longer see the "Write Page", "Manage Page", or any Categories menu items. All done!