Making WordPress.org

Ticket #1840: 1840.diff

File 1840.diff, 1.3 KB (added by obenland, 9 years ago)
  • cli/class-import.php

     
    133133                        $plugin->post_modified = $plugin->post_modified_gmt = current_time( 'mysql' );
    134134                }
    135135
     136                /*
     137                 * Assign first committer as plugin author if the original author
     138                 * doesn't have commit anymore.
     139                 */
     140                $committers = Tools::get_plugin_committers( $plugin_slug );
     141                $author     = get_user_by( 'id', $topic->topic_author );
     142                if ( ! $author || ! in_array( $author->login, $committers ) ) {
     143                        $author = get_user_by( 'login', $committers[0] );
     144
     145                        if ( $author ) {
     146                                $plugin->post_author = $author->ID;
     147                        }
     148                }
     149
    136150                add_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ), 10, 2 );
    137151                wp_update_post( $plugin );
    138152                remove_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ) );
     
    179193                update_post_meta( $plugin->ID, 'assets_banners_color', wp_slash( $banner_average_color ) );
    180194
    181195                // Give committers a role on this site.
    182                 foreach ( Tools::get_plugin_committers( $plugin_slug ) as $committer ) {
     196                foreach ( $committers as $committer ) {
    183197                        $user = get_user_by( 'login', $committer );
    184198
    185199                        if ( $user && ! user_can( $user, 'plugin_dashboard_access' ) ) {