Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 1 commit
  • 1 file changed
  • 0 commit comments
  • 1 contributor
Commits on Feb 04, 2014
@tierra Hide 'add category' in link add/edit form when user does not have the…
… manage_categories capability, fixes #13972.
35c929f
Showing with 13 additions and 10 deletions.
  1. +13 −10 src/wp-admin/includes/meta-boxes.php
View
23 src/wp-admin/includes/meta-boxes.php
@@ -741,6 +741,7 @@ function link_submit_meta_box($link) {
* @param object $link
*/
function link_categories_meta_box($link) {
+ $taxonomy = get_taxonomy( 'link_category' );
?>
<div id="taxonomy-linkcategory" class="categorydiv">
<ul id="category-tabs" class="category-tabs">
@@ -765,16 +766,18 @@ function link_categories_meta_box($link) {
</ul>
</div>
- <div id="category-adder" class="wp-hidden-children">
- <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
- <p id="link-category-add" class="wp-hidden-child">
- <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
- <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
- <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
- <span id="category-ajax-response"></span>
- </p>
- </div>
+ <?php if ( current_user_can( $taxonomy->cap->manage_terms ) ) : ?>
+ <div id="category-adder" class="wp-hidden-children">
+ <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
+ <p id="link-category-add" class="wp-hidden-child">
+ <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+ <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
+ <input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
+ <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
+ <span id="category-ajax-response"></span>
+ </p>
+ </div>
+ <?php endif; ?>
</div>
<?php
}

No commit comments for this range

Something went wrong with that request. Please try again.