WordPress Remove Submenus

Replace all occurrences of $current_user->user_login == 'username' with in_array('editor', $current_user->roles). And you can remove the call to get_currentuserinfo(); as for the user information is available from the global variable $current_user.

Here’s a code swap:

add_action('_admin_menu', 'remove_editor_submenu', 1);
function remove_editor_submenu() {
    global $current_user;
    if(in_array('editor', $current_user->roles)) {
        remove_action('admin_menu', '_add_themes_utility_last', 101);
    }
}

add_action('admin_init', 'remove_theme_submenus');
function remove_theme_submenus() {
    global $submenu, $current_user;
    if(in_array('editor', $current_user->roles)) {
        unset($submenu['themes.php'][5]);
        unset($submenu['themes.php'][7]);
        unset($submenu['themes.php'][15]);
    }
}