Index: src/wp-includes/default-widgets.php =================================================================== --- src/wp-includes/default-widgets.php (revision 31602) +++ src/wp-includes/default-widgets.php (working copy) @@ -1430,6 +1430,145 @@ } /** + * Author Widget class + * + * @since 4.3 + */ +class WP_Author_Widget extends WP_Widget { + public function __construct() { + parent::__construct( 'authors', __( 'Authors' ), array( + 'classname' => 'author_widget', + 'description' => __( "Display blog's authors with avatars and archive links." ), + ), + array( + 'width' => 300, + ) + ); + + add_action( 'save_post', array( $this, 'flush_widget_cache' ) ); + add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) ); + add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) ); + add_action( 'profile_update', array( $this, 'flush_widget_cache' ) ); + + if ( is_active_widget( false, false, $this->id_base ) ) { + add_action( 'wp_head', array( $this, 'author_style' ) ); + } + } + + public function widget( $args, $instance ) { + $cache = get_transient( 'author_widget_' . $this->id ); + + if ( ! empty( $cache ) ) { + echo $cache; + return; + } + + $authors = get_users( array( + 'fields' => array( 'ID', 'user_nicename', 'display_name' ), + 'who' => 'authors', + ) ); + + $widget = $args['before_widget']; + if ( ! empty( $instance['title'] ) ) { + $widget .= $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title']; + } + $widget .= '
+ +
++ +
++ +
+ id_base ) ) + return; + ?> + +