Make WordPress Core

Ticket #26387: 26387.9.diff

File 26387.9.diff, 2.3 KB (added by ryelle, 9 years ago)
  • src/wp-admin/about.php

     
    8181                <div>
    8282                        <h3><?php echo ( 'Pick a color' ); ?></h3>
    8383                        <p><?php echo ( 'We&#8217;ve included four color schemes so that you can choose your favorite. Don&#8217;t like this striking new admin? Choose from any of the schemes below to change it in an instant.' ); ?></p>
     84                        <?php $user_id = get_current_user_id(); ?>
    8485                        <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) :?>
    8586                                <?php
     87                                wp_nonce_field('update-user_' . $user_id);
    8688                                /** This action is documented in wp-admin/user-edit.php */
    8789                                do_action( 'admin_color_scheme_picker' );
    8890                                ?>
    8991                        <?php else : ?>
    9092                                <img src="<?php echo admin_url( 'images/about-color-schemes.png' ); ?>" />
    9193                        <?php endif; ?>
    92                         <p><?php printf( ( 'To change your color scheme later, just <a href="%1$s">visit your profile settings</a>.' ), get_edit_profile_url( get_current_user_id() ) ); ?></p>
     94                        <p><?php printf( ( 'To change your color scheme later, just <a href="%1$s">visit your profile settings</a>.' ), get_edit_profile_url( $user_id ) ); ?></p>
    9395                </div>
    9496        </div>
    9597</div>
  • src/wp-admin/js/about.js

     
    1 /* global isRtl */
     1/* global ajaxurl */
    22(function($){
    33
    44        $(document).ready( function() {
     
    1010       
    1111                $colorpicker = $( '#color-picker' );
    1212                $stylesheet = $( '#colors-css' );
    13                 if ( isRtl ){
    14                         $stylesheet = $( '#colors-rtl-css' );
    15                 }
    1613       
    1714                $colorpicker.on( 'click.colorpicker', '.color-option', function() {
    1815                        var colors, css_url,
     
    2825                        // Set color scheme
    2926                        // Load the colors stylesheet
    3027                        css_url = $this.children( '.css_url' ).val();
    31                         if ( isRtl ){
    32                                 css_url = css_url.replace('.min', '-rtl.min');
    33                         }
    34 
    3528                        $stylesheet.attr( 'href', css_url );
    3629
    3730                        // repaint icons
     
    4538                                        wp.svgPainter.paint();
    4639                                }
    4740                        }
     41                       
     42                        // update user option
     43                        $.post( ajaxurl, {
     44                                action:       'save-user-color-scheme',
     45                                color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
     46                                nonce:        $('#_wpnonce').val()
     47                        });
    4848                });
    4949        });
    5050