Making WordPress.org

Changeset 10327


Ignore:
Timestamp:
09/30/2020 07:13:01 AM (4 years ago)
Author:
dd32
Message:

Make: Trac Components: Link to maintainers profiles properly when user_login != user_nicename.

Skips invalid logins entered in maintainers list, so it's more obvious when the incorrect data is added for a maintainer.

File:
1 edited

Legend:

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

    r10298 r10327  
    390390            echo '<ul class="maintainers">';
    391391            foreach ( $maintainers as $maintainer ) {
     392                $maintainer = get_user_by( 'login', $maintainer );
     393                if ( ! $maintainer ) {
     394                    continue;
     395                }
     396
    392397                printf( '<li><a href="//profiles.wordpress.org/%s">%s %s</a></li>',
    393                     esc_attr( $maintainer ),
    394                     get_avatar( get_user_by( 'login', $maintainer )->user_email, 36 ),
    395                     $maintainer
     398                    esc_attr( $maintainer->user_nicename ),
     399                    get_avatar( $maintainer->user_email, 36 ),
     400                    $maintainer->display_name ?: $maintainer->user_login
    396401                );
    397402            }
     
    718723        echo '<td class="no-grav maintainers">';
    719724        foreach ( $maintainers as $maintainer ) {
    720             echo '<a href="//profiles.wordpress.org/' . esc_attr( $maintainer ) . '" title="' . esc_attr( $maintainer ) . '">' . get_avatar( get_user_by( 'login', $maintainer )->user_email, 24 ) . "</a>";
     725            $maintainer = get_user_by( 'login', $maintainer );
     726            if ( ! $maintainer ) {
     727                continue;
     728            }
     729
     730            echo '<a href="//profiles.wordpress.org/' . esc_attr( $maintainer->user_nicename ) . '" title="' . esc_attr( $maintainer->display_name ) . '">' . get_avatar( $maintainer->user_email, 24 ) . "</a>";
    721731        }
    722732        echo '</td>';
Note: See TracChangeset for help on using the changeset viewer.