Changeset 4197
- Timestamp:
- 10/07/2016 04:44:39 AM (8 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/api/routes/class-plugin.php
r3888 r4197 68 68 $result['contributors'] = array(); 69 69 70 $contributors = get_post_meta( $post_id, 'contributors', true ) ?: array( $post->user_login ); 70 if ( $contributors = get_the_terms( $post->ID, 'plugin_contributors' ) ) { 71 $contributors = wp_list_pluck( $contributors, 'slug' ); 72 } else { 73 $contributors = array(); 74 if ( $author = get_user_by( 'id', $post->post_author ) ) { 75 $contributors[] = $author->user_nicename; 76 } 77 } 71 78 foreach ( $contributors as $contributor ) { 72 79 $user = get_user_by( 'slug', $contributor ); -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r4008 r4197 196 196 ) ); 197 197 198 register_taxonomy( 'plugin_tags', 'plugin', array( 198 register_taxonomy( 'plugin_contributors', array( 'plugin', 'force-count-to-include-all-post_status' ), array( 199 'hierarchical' => false, 200 'query_var' => 'plugin_contributor', 201 'rewrite' => false, 202 'labels' => array( 203 'name' => __( 'Plugin Contributors', 'wporg-plugins' ), 204 'singular_name' => __( 'Plugin Contributor', 'wporg-plugins' ), 205 ), 206 'public' => true, 207 'show_ui' => true, 208 'show_admin_column' => false, 209 'capabilities' => array( 210 'assign_terms' => 'do_not_allow', 211 ), 212 ) ); 213 214 register_taxonomy( 'plugin_tags', array( 'plugin', 'force-count-to-include-all-post_status' ), array( 199 215 'hierarchical' => false, 200 216 'query_var' => 'plugin_tags', … … 453 469 */ 454 470 public function pre_insert_term_prevent( $term, $taxonomy ) { 455 if ( 'plugin_tags' != $taxonomy && ! is_super_admin() ) { 471 $allowed_taxonomies = array( 'plugin_tags', 'plugin_contributors' ); 472 473 if ( ! in_array( $taxonomy, $allowed_taxonomies ) && ! is_super_admin() ) { 456 474 $term = new \WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) ); 457 475 } … … 518 536 return $posts; 519 537 }, 10, 2 ); 538 } 539 540 if ( isset( $wp_query->query['author_name'] ) || isset( $wp_query->query['author'] ) ) { 541 $user = isset( $wp_query->query['author_name'] ) ? $wp_query->query['author_name'] : (get_user_by( 'id', $wp_query->query['author'])->user_nicename); 542 543 $wp_query->query_vars['plugin_contributor'] = $user; 544 $wp_query->query_vars['orderby'] = 'post_title'; 545 $wp_query->query_vars['order'] = 'ASC'; 546 547 unset( $wp_query->query_vars['author_name'], $wp_query->query_vars['author'] ); 548 520 549 } 521 550 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/cli/class-import.php
r3897 r4197 27 27 'license_uri', 28 28 'upgrade_notice', 29 'contributors',30 29 'screenshots' 31 30 ); … … 147 146 // Set tags from the readme 148 147 wp_set_post_terms( $plugin->ID, $readme->tags, 'plugin_tags' ); 148 149 // Update the contributors list 150 wp_set_post_terms( $plugin->ID, $readme->contributors, 'plugin_contributors' ); 149 151 150 152 if ( in_array( 'adopt-me', $readme->tags ) ) { -
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/standalone/class-plugins-info-api-request.php
r4125 r4197 164 164 // Tags 165 165 if ( ! empty( $this->args->tag ) ) { 166 $query['plugin_tag '] = is_array( $this->args->tag ) ? reset( $this->args->tag ) :$this->args->tag;166 $query['plugin_tags'] = $this->args->tag; 167 167 } 168 168 … … 175 175 if ( ! empty( $this->args->author ) ) { 176 176 $query['author_name'] = $this->args->author; 177 //$query['contributor_search'] = $this->args->author; // TODO178 177 } 179 178
Note: See TracChangeset
for help on using the changeset viewer.