Remove admin menu, admin header and admin footer for authors

I would like to remove everything except the “form” in wp-admin/post.php

I would like to do this for user role “author” only.

The reason for all this: I want the wp-admin/post.php to be a page where the author only can edit the content, clean from everything else (the will be linked to the page from the mainpage…)

Today I have slowed this using CSS. But that loads all unnecessary HTML, js and CSS files.

Now I wonder if there’s a way to do this using PHP?

Thanks in advance!

edit:

Se this link: http://i.stack.imgur.com/ziCg9.jpg (new users aren’t allowed to post images…)

I want the admin panel to only show this when authors press the “edit-post-link”.

if ($current_user->user_level < 8){code here...}

1 Answer
1

I Think there is no hooks that I can find to remove those areas without touching the core files..

You can remove parts of the admin areas using this functions and with some css help.

To hide Menus

// remove unnecessary menus  
function remove_admin_menus () {  
    global $menu;  
    // all users  
    $restrict = explode(',', 'Links,Comments');  
    // non-administrator users  
    $restrict_user = explode(',', 'Media,Profile,Appearance,Plugins,Users,Tools,Settings,Dashboard,Posts,Pages');  
    // WP localization  
    $f = create_function('$v,$i', 'return __($v);');  
    array_walk($restrict, $f);  
    if (!current_user_can('activate_plugins')) {  
        array_walk($restrict_user, $f);  
        $restrict = array_merge($restrict, $restrict_user);  
    }  
    // remove menus  
    end($menu);  
    while (prev($menu)) {  
        $k = key($menu);  
        $v = explode(' ', $menu[$k][0]);  
        if(in_array(is_null($v[0]) ? '' : $v[0] , $restrict)) unset($menu[$k]);  
    }  
}  
add_action('admin_menu', 'remove_admin_menus');  


?>

To Brand your Header

/**REPLACE WP LOGO**/
function custom_admin_css() {
echo '<link rel="stylesheet" id="custom_admin" type="text/css" href="' . get_bloginfo('template_directory') . '/custom/custom_admin.css" />';
}

add_action('admin_head','custom_admin_css');
/**END REPLACE WP LOGO**/

And create a custom_admin.css file with this line

#header-logo {background-image: url(images/client_logo.jpg);}

To modify Header Menu

//Edit Top Menu
function custom_favorite_actions($actions) {
  unset($actions['edit-comments.php']); //remove Comments from menu
  unset($actions['media-new.php']); // remove Upload media menu
  unset($actions['post-new.php?post_type=page']); // Remove options/menu for new pages

  return $actions;
}

add_filter('favorite_actions', 'custom_favorite_actions');

To Replace the footer

/**REPLACE FOOTER TEXT**/
function filter_footer_admin() { ?>
Created by <a href="#">Your Company</a> | Built with <a href="http://wordpress.org">WordPress</a>
<?php }

add_filter('admin_footer_text', 'filter_footer_admin');
/**END REPLACE FOOTER TEXT**/

Leave a Comment