- Timestamp:
- 05/10/2022 04:35:32 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/api.wordpress.org/public_html/dotorg/helpscout/plugins-themes.php
r11823 r11825 25 25 26 26 switch_to_blog( $site_id ); 27 28 $slugs = []; 29 if ( 'plugin' === $type ) { 30 // Committer to a plugin. 31 $slugs = $wpdb->get_col( $wpdb->prepare( 'SELECT path FROM `' . PLUGINS_TABLE_PREFIX . 'svn_access' . '` WHERE user = %s', $user->user_login ) ); 32 $slugs = array_filter( array_map( function( $slug ) { 33 return ltrim( $slug, '/' ) ?: false; 34 }, $slugs ) ); 35 36 // TODO: Would be nice to pull for support reps too, but that's less common. 37 } 38 39 $slugs = $slugs ? '"' . implode( '", "', array_map( 'esc_sql', $slugs ) ) . '"' : ''; 40 $or_slugs = $slugs ? "OR post_name IN( {$slugs} )" : ''; 41 27 42 $counts = $wpdb->get_results( $wpdb->prepare( 28 "SELECT post_status, COUNT(*) as count, group_concat( ID ) as ids, group_concat( post_title SEPARATOR ', ' ) as titles FROM $wpdb->posts WHERE post_type = %s AND post_author = %s GROUP BY post_status", 43 "SELECT post_status, COUNT(*) as count, group_concat( ID ) as ids, group_concat( post_title SEPARATOR ', ' ) as titles 44 FROM $wpdb->posts 45 WHERE post_type = %s AND ( post_author = %s {$or_slugs} ) 46 GROUP BY post_status", 29 47 $post_type, 30 48 $user->ID 31 49 ) ); 50 32 51 if ( $counts ) { 33 52 $total = array_sum( wp_list_pluck( $counts, 'count' ) ); … … 47 66 add_query_arg( [ 'post_type' => $post_type, 'author' => $user->ID ], admin_url( 'edit.php' ) ), 48 67 esc_attr( $post_statii ), 49 ucwords( _n( "$total $type", "{$total} {$type}s", $total ) ) // Real bad internationalisation where internationalisation will bever be used.68 ucwords( _n( "$total $type", "{$total} {$type}s", $total ) ) // Real bad internationalisation where internationalisation will never be used. 50 69 ); 51 70
Note: See TracChangeset
for help on using the changeset viewer.