Make WordPress Core


Ignore:
Timestamp:
11/13/2013 07:37:10 PM (11 years ago)
Author:
helen
Message:

Merge the color schemes component from MP6. Introduces Light, Blue, and Midnight.

Color scheme selection on your own profile page gives you a preview and autosaves the selection.

Also introduces the usage of a preprocessor for core files, namely Sass. For 3.8, we will not expand its implementation past the color schemes. This does require Ruby as well as Sass 3.3.0+ due to the usage of the sourcemap option.

Note that only the default color scheme is available when running out of src. Use build to test the rest as well as the color picker.

props ryelle, melchoyce, tillkruess, drw158, littlethingsstudio, helen. see #25858, #22862.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r25868 r26137  
    22452245    wp_send_json_success( $return );
    22462246}
     2247
     2248/**
     2249 * Auto-save the selected color scheme for a user's own profile.
     2250 *
     2251 * @since  3.8.0
     2252 */
     2253function wp_ajax_save_user_color_scheme() {
     2254    global $_wp_admin_css_colors;
     2255
     2256    $user_id = intval( $_POST['user_id'] );
     2257    $color_scheme = sanitize_key( $_POST['color_scheme'] );
     2258
     2259    if ( get_current_user_id() !== $user_id )
     2260        wp_send_json_error();
     2261
     2262    if ( ! get_user_by( 'id', $user_id ) )
     2263        wp_send_json_error();
     2264
     2265    if ( ! isset( $_wp_admin_css_colors[ $color_scheme ] ) )
     2266        wp_send_json_error();
     2267
     2268    update_user_option( $user_id, 'admin_color', $color_scheme, true );
     2269    wp_send_json_success();
     2270}
Note: See TracChangeset for help on using the changeset viewer.