Changeset 3578 for sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
- Timestamp:
- 06/26/2016 09:58:21 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-directory.php
r3569 r3578 42 42 add_filter( 'post_type_link', array( $this, 'package_link' ), 10, 2 ); 43 43 add_filter( 'term_link', array( $this, 'term_link' ), 10, 2 ); 44 add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ) );44 add_filter( 'pre_insert_term', array( $this, 'pre_insert_term_prevent' ), 10, 2 ); 45 45 add_filter( 'tax_input_pre', array( $this, 'filter_tax_input' ) ); 46 46 add_action( 'pre_get_posts', array( $this, 'use_plugins_in_query' ) ); … … 196 196 ) ); 197 197 198 register_taxonomy( 'plugin_tags', 'plugin', array( 199 'hierarchical' => false, 200 'query_var' => 'plugin_tags', 201 'rewrite' => array( 202 'hierarchical' => false, 203 'slug' => 'tags', 204 'with_front' => false, 205 'ep_mask' => EP_TAGS, 206 ), 207 'labels' => array( 208 'name' => __( 'Plugin Tags', 'wporg-plugins' ), 209 'singular_name' => __( 'Plugin Tag', 'wporg-plugins' ), 210 'edit_item' => __( 'Edit Tag', 'wporg-plugins' ), 211 'update_item' => __( 'Update Tag', 'wporg-plugins' ), 212 'add_new_item' => __( 'Add New Tag', 'wporg-plugins' ), 213 'new_item_name' => __( 'New Tag Name', 'wporg-plugins' ), 214 'search_items' => __( 'Search Tags', 'wporg-plugins' ), 215 ), 216 'public' => true, 217 'show_ui' => true, 218 'show_admin_column' => false, 219 'meta_box_cb' => false, 220 'capabilities' => array( 221 'assign_terms' => 'do_not_allow', 222 ), 223 ) ); 224 198 225 register_post_status( 'pending', array( 199 226 'label' => _x( 'Pending', 'plugin status', 'wporg-plugins' ), … … 421 448 * Checks if the current users is a super admin before allowing terms to be added. 422 449 * 423 * @param string $term The term to add or update. 450 * @param string $term The term to add or update. 451 * @param string $taxonomy The taxonomy of the term. 424 452 * @return string|\WP_Error The term to add or update or WP_Error on failure. 425 453 */ 426 public function pre_insert_term_prevent( $term ) {427 if ( ! is_super_admin() ) {454 public function pre_insert_term_prevent( $term, $taxonomy ) { 455 if ( 'plugin_tags' != $taxonomy && ! is_super_admin() ) { 428 456 $term = new \WP_Error( 'not-allowed', __( 'You are not allowed to add terms.', 'wporg-plugins' ) ); 429 457 }
Note: See TracChangeset
for help on using the changeset viewer.