Created
October 12, 2010 01:58
-
-
Save mjangda/621541 to your computer and use it in GitHub Desktop.
Add necessary caps to admin and editor roles to manage usergroups
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'admin_init', 'ef_usergroups_cap_fix' ); | |
function ef_usergroups_cap_fix() { | |
global $wp_roles; | |
if ( ! isset( $wp_roles ) ) | |
$wp_roles = new WP_Roles(); | |
// Add necessary capabilities to allow management of usergroups and post subscriptions | |
// edit_post_subscriptions - administrator + editor | |
// edit_usergroups - adminstrator | |
if( $wp_roles->is_role('administrator') ) { | |
$admin_role =& get_role('administrator'); | |
$admin_role->add_cap('edit_post_subscriptions'); | |
$admin_role->add_cap('edit_usergroups'); | |
} | |
if( $wp_roles->is_role('editor') ) { | |
$editor_role =& get_role('editor'); | |
$editor_role->add_cap('edit_post_subscriptions'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment