Ticket #13972: 13972.diff

File 13972.diff, 2.3 KB (added by wojtek.szkutnik, 3 years ago)
  • meta-boxes.php

     
    630630 * 
    631631 * @param object $link 
    632632 */ 
    633 function link_categories_meta_box($link) { ?> 
     633function link_categories_meta_box($link) {  
     634        $tax = get_taxonomy( 'category' ); 
     635?> 
    634636<ul id="category-tabs" class="category-tabs"> 
    635637        <li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li> 
    636638        <li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li> 
     
    653655        </ul> 
    654656</div> 
    655657 
    656 <div id="category-adder" class="wp-hidden-children"> 
    657         <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> 
    658         <p id="link-category-add" class="wp-hidden-child"> 
    659                 <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> 
    660                 <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> 
    661                 <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" /> 
    662                 <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> 
    663                 <span id="category-ajax-response"></span> 
    664         </p> 
    665 </div> 
     658<?php if ( !current_user_can( $tax->cap->assign_terms ) ) : ?> 
     659        <p><em><?php _e('You cannot modify categories.'); ?></em></p> 
     660<?php endif; ?> 
     661<?php if ( current_user_can( $tax->cap->edit_terms ) ) : ?> 
     662    <div id="category-adder" class="wp-hidden-children"> 
     663        <h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4> 
     664        <p id="link-category-add" class="wp-hidden-child"> 
     665            <label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label> 
     666            <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" /> 
     667            <input type="button" id="category-add-submit" class="add:categorychecklist:linkcategorydiv button" value="<?php esc_attr_e( 'Add' ); ?>" /> 
     668            <?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?> 
     669            <span id="category-ajax-response"></span> 
     670        </p> 
     671    </div> 
    666672<?php 
     673endif; 
    667674} 
    668675 
    669676