Yesterday I wrote about my collection of favorite WordPress plugins for managing a private user community. One of the plugins I mentioned was Absolute Privacy.
I love my friends, but I wouldn’t trust most of them with a loaded weapon. Similarly, I want to give my editors the ability to approve new users in a closed WordPress forum I set up for one of our clients, but I don’t want to give editors all of the functionality that comes with the manage_options Capability.
I’m using the Absolute Privacy plugin for WordPress, which I’ve slowly been modifying myself, so it’s the one plug-in I’ve set to version 999 to ensure that it doesn’t get accidentally overridden by an overzealous admin (read: me). This means it’s also the one plugin I’ve been playing around with deeply.
By default, Absolute Privacy tests against the manage_options Capability flag to see if you should have permission to moderate new users. I don’t want to give my editors the ability to manage all WordPress options, so I did the following:
- In Users->Roles, I added a new capability called approve_new_users, and gave Administrators and Editors the capability.
- Then I went into the code for Absolute Privacy and found the function that creates the Moderate Users menu item. I edited two lines of code:
- I replaced the line that tests the user’s Capability to read
if (!current_user_can('approve_new_users')) - I edited the add_submenu_page call to read
add_submenu_page('users.php', 'Moderate Users', 'Moderate Users', 'approve_new_users', basename(__FILE__), array(&$this,'moderateUsers'));
- I replaced the line that tests the user’s Capability to read
Done!

No Comment Received