Making WordPress.org

Changeset 5204


Ignore:
Timestamp:
03/30/2017 04:39:59 AM (9 years ago)
Author:
dd32
Message:

Plugin Directory: Use the Author and Author URI plugin headers in the API response instead of the original plugin submitters details.
This doesn't change author_profile which still references the original uploaders profile, as it always has. This field doesn't appear to be used by WordPress though.

Props obenland for initial patch.
Fixes #2585.

File:
1 edited

Legend:

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

    r4900 r5204  
    6868                $result['version'] = get_post_meta( $post_id, 'version', true ) ?: '0.0';
    6969
    70                 $author = get_user_by( 'id', $post->post_author );
    71                 $result['author'] = $author->display_name;
    72                 if ( $author->user_url ) {
    73                         $result['author'] = sprintf( '<a href="%s">%s</a>', $author->user_url, $result['author'] );
    74                 }
    75 
     70                $result['author'] = strip_tags( get_post_meta( $post_id, 'header_author', true ) ) ?: get_user_by( 'id', $post->post_author )->display_name;
     71                if ( false != ( $author_url = get_post_meta( $post_id, 'header_author_uri', true ) ) ) {
     72                        $result['author'] = sprintf( '<a href="%s">%s</a>', esc_url_raw( $author_url ), $result['author'] );
     73                }
     74
     75                // Profile of the original plugin submitter
    7676                $result['author_profile'] = $this->get_user_profile_link( $post->post_author );
    7777                $result['contributors'] = array();
     
    224224                                $u = get_user_by( 'slug', $user );
    225225                        }
     226                }
     227
     228                if ( ! $u ) {
     229                        return false;
    226230                }
    227231
Note: See TracChangeset for help on using the changeset viewer.