Make WordPress Core


Ignore:
Timestamp:
11/23/2011 06:30:45 PM (12 years ago)
Author:
nacin
Message:

Change show/hide storage mechanism for show_welcome_panel. 0 = hide, 1 = show, 2 = show if the multisite owner. Make welcome panel dismissable without JS (openable too via the URL). fixes #19338, fixes #19127.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/screen.php

    r19385 r19418  
    825825
    826826                    if ( 'dashboard' === $this->id && current_user_can( 'edit_theme_options' ) ) {
     827                        if ( isset( $_GET['welcome'] ) ) {
     828                            $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1;
     829                            update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked );
     830                        } else {
     831                            $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
     832                            if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) )
     833                                $welcome_checked = false;
     834                        }
    827835                        echo '<label for="wp_welcome_panel-hide">';
    828                         echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) get_user_option( 'show_welcome_panel' ), true, false )  . ' />';
     836                        echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false )  . ' />';
    829837                        echo __( 'Welcome' ) . "</label>\n";
    830838                    }
Note: See TracChangeset for help on using the changeset viewer.