Tuesday, January 15, 2013

Enable widgets for editor role

$role_object = get_role( 'editor' );
//print_r($role_objec);
// add $cap capability to this role object
$role_object->add_cap( 'edit_theme_options' );

function custom_admin_menu() {

$user = new WP_User(get_current_user_id());
if (!empty( $user->roles) && is_array($user->roles)) {
foreach ($user->roles as $role)
$role = $role;
}

if($role == "editor") {
remove_submenu_page( 'themes.php', 'themes.php' );
remove_submenu_page( 'themes.php', 'nav-menus.php' );
remove_submenu_page( 'themes.php', 'theme_options' );
remove_submenu_page( 'themes.php', 'custom-header' );
}
}

add_action('admin_menu', 'custom_admin_menu', 11);


No comments:

Post a Comment