Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I was wondering if anyone knew of a plugin or a way programmatically to change the the default admin page for a specific user/role?

I have a master panel page for my plugin currently setup with custom roles and permissions for the plugin using the Members Plugin and would like to force users that are in these custom roles to use my master control panel for their dashboard because they don't necessarily need access to the Dashboard.

Minor Edit: Along with changing the default dashboard for the roles, is there a way to disable the WordPress dashboard?

-Zack

share|improve this question
add comment

3 Answers 3

up vote 4 down vote accepted

In your theme's functions.php:

function hide_the_dashboard() {
    global $current_user;
    // is there a user ?
    if(is_array($current_user->roles)) {
        // substitute your role(s):
        if(in_array('custom_role', $current_user->roles)) {
            // hide the dashboard:
            remove_menu_page('index.php');
        }
    }
}
add_action('admin_menu', 'hide_the_dashboard');

function your_login_redirect( $redirect_to, $request, $user ) {
    // is there a user ?
    if(is_array($user->roles)) {
        // substitute your role(s):
        if(in_array('custom_role', $user->roles)) {
            // pick where to redirect to, in the example: Posts page
            return admin_url('edit.php');
        } else {
            return admin_url();
        }
    }
}
add_filter('login_redirect', 'your_login_redirect', 10, 3);
share|improve this answer
add comment

Use the Theme My Login plugin.

This plugin themes the WordPress login, registration and forgot password pages according to your current theme. It creates a page to use in place of wp-login.php, using a page template from your theme. Also includes a widget for sidebar login.

Features

  • ...
  • Redirect users upon log in and log out based upon their role
  • ...
share|improve this answer
add comment

Ad Dashboard: You could check the $_REQUEST and depending on what you get back, simply use wp_redirect();

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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