Making WordPress.org


Ignore:
Timestamp:
06/20/2016 10:03:29 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Update the handling for Plugin Authors in the API.

See #1584

File:
1 edited

Legend:

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

    r3440 r3496  
    5858        $result['version'] = get_post_meta( $post_id, 'version', true );
    5959
    60         if ( get_post_meta( $post_id, 'header_author_uri', true ) ) {
    61             $result['author'] = sprintf( '<a href="%s">%s</a>', get_post_meta( $post_id, 'header_author_uri', true ), get_post_meta( $post_id, 'header_author', true ) );
    62         } elseif ( get_post_meta( $post_id, 'header_author', true )  ) {
    63             $result['author'] = get_post_meta( $post_id, 'header_author', true );
    64         } else {
    65             $result['author'] = get_user_by( 'id', $post->post_author )->display_name;
     60        $author = get_user_by( 'id', $post->post_author );
     61        $result['author'] = $author->display_name;
     62        if ( $author->user_url ) {
     63            $result['author'] = sprintf( '<a href="%s">%s</a>', $author->user_url, $result['author'] );
    6664        }
    6765
     
    6967        $result['contributors'] = array();
    7068
    71         $contributors = get_post_meta( $post_id, 'contributors', true ) ?: array( (int) $post->post_author );
     69        $contributors = get_post_meta( $post_id, 'contributors', true ) ?: array( $post->user_login );
    7270        foreach ( $contributors as $contributor ) {
    73             $user = is_int( $contributor ) ? get_user_by( 'id', $contributor ) : get_user_by( 'slug', $contributor );
     71            $user = get_user_by( 'slug', $contributor );
    7472            if ( ! $user ) {
    7573                continue;
Note: See TracChangeset for help on using the changeset viewer.