Show Welcome Panel on Dashboard for every user

I have customised the welcome panel on the dashboard for users with information in. I then hid the “Dismiss” button and added CSS to make the welcome panel always visible. Using the ‘welcome_panel’ hook.

This works fine for Admins but the Welcome Panel is not displayed for other users such as editors and authors. Its not that the admin panel is being hidden its not included in the source code.

Read More

I need to find a way to include the welcome panel code for every user not just admins.

Just found the following in wp-admin/index.php. So it will only show if user can edit_theme_options.

<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :

Is there a way to edit this or call the do_action( ‘welcome_panel’ ); even if the user cannot edit_theme_options?

Related posts

Leave a Reply

2 comments

  1. This is how I solved it:

    In functions.php

    // Custom Dashboard
    function my_custom_dashboard() {
        $screen = get_current_screen();
        if( $screen->base == 'dashboard' ) {
            include 'admin/dashboard-panel.php';
        }
    }
    add_action('admin_notices', 'my_custom_dashboard');
    

    dashboard-panel.php

    <!-- Hide Old Wrap with CSS -->
    <style type="text/css">
    div#wpcontent div.wrap {
        display: none;
    }
    div#wpcontent div.my-dashboard {
        display: block;
    }
    </style>
    
    <!-- New Wrap with custom welcome screen-->
    <div class="wrap mjp-dashboard">
        <h2>Dashboard</h2>
    
        <div id="welcome-panel" class="welcome-panel">
            <?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
            <?php //do_action( 'welcome_panel' ); ?>
            <div class="mjp-welcome-content">
                <h3>Welcome, <?php echo $name; ?></h3>
                <p class="about-description">Your role is...</p>
                <div class="welcome-panel-column-container">
                    <div class="welcome-panel-column">
    
                    </div>
                </div>
            </div>
        </div>
    
        <div id="dashboard-widgets-wrap">
    
        <?php wp_dashboard(); ?>
    
        <div class="clear"></div>
        </div><!-- dashboard-widgets-wrap -->
    
    </div><!-- wrap -->
    
  2. As you already discovered, the display conditions for that panel are hard-coded into a core file. It isn’t meant to be changed, which means you are probably trying to use the panel for something it is not intended for. That isn’t criticism. It just makes it hard. I don’t see a way to change that except by editing a core file, and I don’t advise that.

    You can try to run the welcome_panel action on some other hook, like one of these, for example, but I wouldn’t expect it to work correctly. If you really, really need the welcome_panel to run for everyone that is your best bet, but I wouldn’t be hopeful.

    You could also give everyone edit_theme_options capability, but that is a bad idea. I am ashamed I thought of it. 🙂

    From what I can tell, your options are pretty limited and really boil down to “core edit”. That is a high-maintenance path to start down. I’d suggest that you put your user information somewhere else, like in a new Dashboard Widget, in a Help screen, or in the admin bar.