Ticket #1840: 1840.diff
File 1840.diff, 1.3 KB (added by , 9 years ago) |
---|
-
cli/class-import.php
133 133 $plugin->post_modified = $plugin->post_modified_gmt = current_time( 'mysql' ); 134 134 } 135 135 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 136 150 add_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ), 10, 2 ); 137 151 wp_update_post( $plugin ); 138 152 remove_filter( 'wp_insert_post_data', array( $this, 'filter_wp_insert_post_data' ) ); … … 179 193 update_post_meta( $plugin->ID, 'assets_banners_color', wp_slash( $banner_average_color ) ); 180 194 181 195 // Give committers a role on this site. 182 foreach ( Tools::get_plugin_committers( $plugin_slug )as $committer ) {196 foreach ( $committers as $committer ) { 183 197 $user = get_user_by( 'login', $committer ); 184 198 185 199 if ( $user && ! user_can( $user, 'plugin_dashboard_access' ) ) {