WordPress.org

Make WordPress Core

Ticket #28953: 28953.diff

File 28953.diff, 1.0 KB (added by welcher, 6 years ago)
  • general-template.php

     
    26532653
    26542654}
    26552655
     2656
    26562657/**
     2658 * Retrieve the admin color scheme for a user.
     2659 *
     2660 *
     2661 * @uses $_wp_admin_css_colors WordPress admin color schemes array
     2662 *
     2663 * @param int $user_id The user id to pull the color scheme for
     2664 * @param int $index The index for the $user_meta['admin_color'] array
     2665 *
     2666 * @return array The data that was registered in wp_admin_css_color for the given scheme
     2667 */
     2668function get_user_admin_color_scheme( $user_id = 0, $index = 0 ) {
     2669        global $_wp_admin_css_colors;
     2670
     2671        if( empty( $user_id ) ) {
     2672                $user = wp_get_current_user();
     2673                $user_meta = get_user_meta( $user->ID );
     2674        }else{
     2675                $user_meta = get_user_meta( $user_id );
     2676        }
     2677
     2678        return $_wp_admin_css_colors[ $user_meta['admin_color'][$index] ];
     2679}
     2680
     2681
     2682/**
    26572683 * Display the URL of a WordPress admin CSS file.
    26582684 *
    26592685 * @see WP_Styles::_css_href and its style_loader_src filter.