Making WordPress.org


Ignore:
Timestamp:
10/21/2016 05:57:46 AM (8 years ago)
Author:
dd32
Message:

Plugin Directory: Add some basic Committer/Contributor widgets for the plugin "admin" view.

See #2111

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-contributors.php

    r4263 r4278  
    2929        $post = get_post();
    3030
     31        $contributors = (array) wp_list_pluck( (array)get_the_terms( $post, 'plugin_contributors' ), 'name' );
     32        $contributors = array_map( function( $user_nicename ) {
     33            return get_user_by( 'slug', $user_nicename );
     34        }, $contributors );
     35
    3136        echo $args['before_widget'];
    3237        ?>
     38        <style>
     39            <?php // TODO: Yes, these need to be moved into the CSS somewhere. ?>
     40            ul.contributors-list {
     41                list-style: none;
     42                margin: 0;
     43                font-size: 0.9em;
     44            }
     45            ul.contributors-list li {
     46                padding-bottom: 0.5em;
     47            }
     48        </style>
     49        <h3><?php _e( 'Contributors', 'wporg-plugins' ); ?></h3>
     50        <p class="widget-subnav"><small><a href="#"><?php _e( 'View the capabilities these users have', 'wporg-plugins' ); ?></a></small></p>
    3351
    34         <h3 class="screen-reader-text"><?php echo apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Committers', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base ); ?></h3>
    35 
     52        <ul id="contributors-list" class="contributors-list read-more" aria-expanded="false">
     53        <?php foreach ( $contributors as $contributor ) {
     54            echo '<li>' . get_avatar( $contributor->ID, 32 ) . '<a href="' . esc_url( 'https://profiles.wordpress.org/' . $contributor->user_nicename ) . '">' . Template::encode( $contributor->display_name ) . '</a></li>';
     55        } ?>
     56        </ul>
     57        <button type="button" class="button-link section-toggle" aria-controls="contributors-list"><?php _e( 'View more', 'wporg-plugins' ); ?></button>
    3658
    3759        <?php
Note: See TracChangeset for help on using the changeset viewer.