Plugins & Themes

Each role with there own dashboard

1 Reply ·

  1. Hi,

    I am looking for a solution where a role has it’s own dashboard. When they login I created a dashboard thru functions.php with “function custom_dashboard_help()”. But now there must be a dashboard per role. Can this be done with your plugin or with an extra add-on?

    Cheers

    MARCO

  2. Justin Tadlock

    Do you mean you have a specific page on your site that needs to show something different depending on the role?

    If so, you can check the user’s role and display something different based on what role(s) they have.

    $user  = new WP_User( get_current_user_id() );
    $roles = (array) $user->roles;
    
    if ( in_array( 'administrator', $roles ) ) {
    
        // Display for administrators.
    
    } elseif ( in_array( 'subscriber', $roles ) ) {
    
        // Display for subscribers.
    
    }