Make WordPress Core

Ticket #30488: 30488.diff

File 30488.diff, 1.1 KB (added by valendesigns, 10 years ago)
  • src/wp-admin/includes/ajax-actions.php

    diff --git src/wp-admin/includes/ajax-actions.php src/wp-admin/includes/ajax-actions.php
    index 303f3b2..97ebb78 100644
    function wp_ajax_save_user_color_scheme() { 
    25822582        }
    25832583
    25842584        update_user_meta( get_current_user_id(), 'admin_color', $color_scheme );
    2585         wp_send_json_success();
     2585        wp_send_json_success( array(
     2586                'color_scheme' => $color_scheme
     2587        ) );
    25862588}
    25872589
    25882590/**
  • src/wp-admin/js/user-profile.js

    diff --git src/wp-admin/js/user-profile.js src/wp-admin/js/user-profile.js
    index 2dd6e2a..4cf596c 100644
     
    119119                                        action:       'save-user-color-scheme',
    120120                                        color_scheme: $this.children( 'input[name="admin_color"]' ).val(),
    121121                                        nonce:        $('#color-nonce').val()
     122                                }).done( function( response ) {
     123                                        if ( response.success && response.data.color_scheme ) {
     124                                                $( 'body' ).removeClass( function (index, css) {
     125                                                        return ( css.match (/(^|\s)admin-color-\S+/g) || [] ).join(' ');
     126                                                }).addClass( 'admin-color-' + response.data.color_scheme );
     127                                        }
    122128                                });
    123129                        }
    124130                });