Making WordPress.org

Changeset 734


Ignore:
Timestamp:
07/01/2014 05:26:45 PM (10 years ago)
Author:
nacin
Message:

Trac Notifications/Components: Use get_avatar() rather than grav-redirect.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-components.php

    r721 r734  
    172172
    173173    function the_content( $content ) {
     174        global $wpdb;
     175
    174176        $post = get_post();
    175177        if ( ! $this->page_is_component( $post ) ) {
     
    242244            echo 'Component maintainers: ';
    243245            echo '<ul class="maintainers">';
    244             foreach ( $maintainers as $maintainer ) {
    245                 echo '<li><a href="//profiles.wordpress.org/' . esc_attr( $maintainer ) . '">';
    246                 echo '<img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=' . esc_attr( $maintainer ) . '&amp;s=36" /></a> ' . $maintainer . '</li>';
     246            foreach ( array_map( 'trim', explode( ',', $maintainers ) ) as $maintainer ) {
     247                echo '<li><a href="//profiles.wordpress.org/' . esc_attr( $maintainer ) . '">' . get_avatar( get_user_by( 'login', $maintainer )->user_email, 36 ) . "</a> $maintainer</li>";
    247248            }
    248249            echo "</ul>\n\n";
     
    253254
    254255        $followers = $this->trac->get_col( $this->trac->prepare( "SELECT username FROM _notifications WHERE type = 'component' AND value = %s", $post->post_title ) );
     256        $followers = "'" . implode( "', '", esc_sql( $followers ) ) . "'";
     257        $followers = $wpdb->get_results( "SELECT user_login, user_nicename, user_email FROM $wpdb->users WHERE user_login IN ($followers)" );
    255258        if ( $followers ) {
    256             echo 'Contributors following this component: ';
     259            echo 'Contributors following this component:';
    257260            echo '<ul class="followers">';
    258261            foreach ( $followers as $follower ) {
    259                 $follower = esc_attr( $follower );
    260                 echo '<li><a title="' . $follower . '" href="//profiles.wordpress.org/' . $follower . '">';
    261                 echo '<img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=' . $follower . '&amp;s=36" /></a></li>';
     262                echo '<li><a title="' . esc_attr( $follower->user_login ) . '" href="//profiles.wordpress.org/' . esc_attr( $follower->user_nicename ) . '">';
     263                echo get_avatar( $follower->user_email, 36 ) . '</a></li>';
    262264            }
    263265            echo '</ul>';
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php

    r461 r734  
    344344                    ?>
    345345                        <a<?php echo $class; ?> title="<?php echo $follower; ?>" href="//profiles.wordpress.org/<?php echo $follower; ?>">
    346                             <img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=<?php echo $follower; ?>&amp;s=36" />
     346                            <?php echo get_avatar( get_user_by( 'login', $follower )->user_email, 36 ); ?>
    347347                            <span class="username"><?php echo $follower; ?></span>
    348348                        </a>
    349349                    <?php endforeach; ?>
    350350                    <a title="you" class="star-you" href="//profiles.wordpress.org/<?php echo esc_attr( $username ); ?>">
    351                         <img width="36" height="36" src="//wordpress.org/grav-redirect.php?user=<?php echo esc_attr( $username ); ?>&amp;s=36" />
     351                        <?php echo get_avatar( wp_get_current_user()->user_email, 36 ); ?>
    352352                        <span class="username"><?php echo $username; ?></span>
    353353                    </a>
Note: See TracChangeset for help on using the changeset viewer.