Make WordPress Core


Ignore:
Timestamp:
11/29/2010 07:24:54 AM (16 years ago)
Author:
PeteMall
Message:

Update and error messages for site-themes. See #14897

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/network/site-themes.php

    r16592 r16606  
    4444                case 'enable':
    4545                        $theme = $_GET['theme'];
     46                        $update = 'enabled';
    4647                        if ( !$allowed_themes )
    4748                                $allowed_themes = array( $theme => true );
     
    5152                case 'disable':
    5253                        $theme = $_GET['theme'];
     54                        $update = 'disabled';
    5355                        if ( !$allowed_themes )
    5456                                $allowed_themes = array();
     
    5759                        break;
    5860                case 'enable-selected':
    59                         $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    60                         if ( empty($themes) ) {
    61                                 restore_current_blog();
    62                                 wp_redirect( wp_get_referer() );
    63                                 exit;
    64                         }                                               
    65                         foreach( (array) $themes as $theme )
    66                                 $allowed_themes[ $theme ] = true;
     61                        if ( isset( $_POST['checked'] ) ) {
     62                                $update = 'enable';
     63                                $themes = (array) $_POST['checked'];
     64                                foreach( (array) $themes as $theme )
     65                                        $allowed_themes[ $theme ] = true;
     66                        } else {
     67                                $update = 'error';
     68                        }
    6769                        break;
    6870                case 'disable-selected':
    69                         $themes = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
    70                         if ( empty($themes) ) {
    71                                 restore_current_blog();
    72                                 wp_redirect( wp_get_referer() );
    73                                 exit;
    74                         }                                               
    75                         foreach( (array) $themes as $theme )
    76                                 unset( $allowed_themes[ $theme ] );
     71                        if ( isset( $_POST['checked'] ) ) {
     72                                $update = 'disable';
     73                                $themes = (array) $_POST['checked'];
     74                                foreach( (array) $themes as $theme )
     75                                        unset( $allowed_themes[ $theme ] );
     76                        } else {
     77                                $update = 'error';
     78                        }
    7779                        break;
    7880        }
     
    8183        restore_current_blog();
    8284       
    83         wp_redirect( wp_get_referer() ); // @todo add_query_arg for update message
     85        wp_redirect( add_query_arg( 'update', $update, wp_get_referer() ) );
    8486        exit;   
    8587}
     
    111113}
    112114?>
    113 </h3>
     115</h3><?php
     116
     117if ( isset( $_GET['update'] ) ) {
     118        switch ( $_GET['update'] ) {
     119        case 'enabled':
     120                echo '<div id="message" class="updated"><p>' . __( 'Theme enabled.' ) . '</p></div>';
     121                break;
     122        case 'disabled':
     123                echo '<div id="message" class="updated"><p>' . __( 'Theme disabled.' ) . '</p></div>';
     124                break;
     125        case 'error':
     126                echo '<div id="message" class="error"><p>' . __( 'No theme selected.' ) . '</p></div>';
     127                break;
     128        }
     129} ?>
     130
    114131<p><?php _e( 'Network enabled themes are not shown on this screen.' ) ?></p>
    115132
Note: See TracChangeset for help on using the changeset viewer.