Changeset 14396
- Timestamp:
- 02/25/2025 03:45:29 AM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/widgets/class-contributors.php
r11804 r14396 38 38 39 39 if ( is_wp_error( $contributors ) ) { 40 return;40 $contributors = []; 41 41 } 42 42 43 if ( $contributors ) { 44 $contributors = array_map( function( $user_nicename ) { 45 return get_user_by( 'slug', $user_nicename ); 46 }, $contributors ); 47 $contributors = array_filter( $contributors ); 43 // The owner of the plugin is always a contributor, and shown first. 44 $plugin_owner = get_the_author_meta( 'user_nicename', $post->post_author ); 45 if ( $plugin_owner && 0 !== array_search( $plugin_owner, $contributors, true ) ) { 46 $contributors = array_unique( 47 array_merge( 48 [ $plugin_owner ], 49 $contributors 50 ) 51 ); 48 52 } 49 53 50 // If no contributors were explicitly or properly listed, default to associated author. 51 if ( ! $contributors && ( $author = get_user_by( 'ID', $post->post_author ) ) ) { 52 $contributors = [ $author ]; 53 } 54 // Convert the user_nicenames to user objects. 55 $contributors = array_map( 56 function( $user_nicename ) { 57 return get_user_by( 'slug', $user_nicename ); 58 }, 59 $contributors 60 ); 61 62 // Remove any users that didn't exist. 63 $contributors = array_filter( $contributors ); 54 64 55 65 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Contributors', 'wporg-plugins' ) : $instance['title'], $instance, $this->id_base );
Note: See TracChangeset
for help on using the changeset viewer.