8

Is it possible to hide the dashboard completely from the Non-admin users and give them access to only New post and edit posts page? Thanks.

4 Answers 4

18

As far as ease of use, especially for WordPress Admins not too firm in PHP, I second brasoflo's plugin recommendation (Adminimize).

For the sake of completeness, this is how it'd be done programmatically:

/* Remove the "Dashboard" from the admin menu for non-admin users */
function wpse52752_remove_dashboard () {
    global $current_user, $menu, $submenu;
    get_currentuserinfo();

    if( ! in_array( 'administrator', $current_user->roles ) ) {
        reset( $menu );
        $page = key( $menu );
        while( ( __( 'Dashboard' ) != $menu[$page][0] ) && next( $menu ) ) {
            $page = key( $menu );
        }
        if( __( 'Dashboard' ) == $menu[$page][0] ) {
            unset( $menu[$page] );
        }
        reset($menu);
        $page = key($menu);
        while ( ! $current_user->has_cap( $menu[$page][1] ) && next( $menu ) ) {
            $page = key( $menu );
        }
        if ( preg_match( '#wp-admin/?(index.php)?$#', $_SERVER['REQUEST_URI'] ) &&
            ( 'index.php' != $menu[$page][2] ) ) {
                wp_redirect( get_option( 'siteurl' ) . '/wp-admin/edit.php');
        }
    }
}
add_action('admin_menu', 'wpse52752_remove_dashboard');
3

You can use the plugin Adminimize to do that.

It is possible to hide the Dashboard (and many other things) based on the user role. In case of hiding the Dashboard, you can define to what page the user will be redirected.

I'm not sure, but I believe you cannot modify the user roles to block the Dashboard (as even the lowest role has access to it).

But if you combine Adminimize with a Role plugin, you can achieve a very fine tuned administrative interface.

1
  • @JohannesPille - there's no a single WordPress install I've done that doesn't runs Adminimize. And cannot praise it enough :)
    – brasofilo
    Commented May 21, 2012 at 11:45
0

Those 2 pages too are a part of the dashboard! If you're giving access to edit posts, means you're giving access to the posts list. The lowest capable role, subscriber, also has access to the profile page, which is also a part of the dashboard! Your best option would be a front end post addition/profile editing form.

1
  • 1
    That depends on how you define "dashboard", a term which is sort of ambiguous, even in the WP context. It can either refer to the entire wp-admin, which appears to be how you've interpreted the question, or to the topmost admin menu page. In the latter case, the menu page can be hidden. Commented May 21, 2012 at 11:30
0

you can use a plugin called "User Role Editor".. You cant avoid dashboard in order to give them access to the New post.. But you can limit their role...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.