Make WordPress Core


Ignore:
Timestamp:
03/28/2010 02:37:10 AM (15 years ago)
Author:
dd32
Message:

Display the list of Terms in a non-hierarchical taxonomy on the Post Edit page even if they cannot modify them. See #12035

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/meta-boxes.php

    r13840 r13855  
    247247    $tax_name = esc_attr(substr($box['id'], 8));
    248248    $taxonomy = get_taxonomy($tax_name);
    249     if ( !current_user_can($taxonomy->assign_cap) ) // @todo: Display the terms, do not edit.
    250         return;
    251249    $helps      = isset( $taxonomy->helps      ) ? esc_attr( $taxonomy->helps ) : esc_attr__('Separate tags with commas.');
    252250    $help_hint  = isset( $taxonomy->help_hint  ) ? $taxonomy->help_hint         : __('Add new tag');
    253251    $help_nojs  = isset( $taxonomy->help_nojs  ) ? $taxonomy->help_nojs         : __('Add or remove tags');
    254252    $help_cloud = isset( $taxonomy->help_cloud ) ? $taxonomy->help_cloud        : __('Choose from the most used tags in %s');
     253   
     254    $disabled = !current_user_can($taxonomy->assign_cap) ? 'disabled="disabled"' : '';
    255255?>
    256256<div class="tagsdiv" id="<?php echo $tax_name; ?>">
     
    258258    <div class="nojs-tags hide-if-js">
    259259    <p><?php echo $help_nojs; ?></p>
    260     <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]"><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
    261 
     260    <textarea name="<?php echo "tax_input[$tax_name]"; ?>" class="the-tags" id="tax-input[<?php echo $tax_name; ?>]" <?php echo $disabled; ?>><?php echo esc_attr(get_terms_to_edit( $post->ID, $tax_name )); ?></textarea></div>
     261    <?php if ( current_user_can($taxonomy->assign_cap) ) : ?>
    262262    <div class="ajaxtag hide-if-no-js">
    263263        <label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>
     
    265265        <input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" value="" />
    266266        <input type="button" class="button tagadd" value="<?php esc_attr_e('Add'); ?>" tabindex="3" />
    267     </div></div>
     267    </div>
    268268    <p class="howto"><?php echo $helps; ?></p>
     269    <?php endif; ?>
     270    </div>
    269271    <div class="tagchecklist"></div>
    270272</div>
     273<?php if ( current_user_can($taxonomy->assign_cap) ) : ?>
    271274<p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php printf( $help_cloud, $box['title'] ); ?></a></p>
     275<?php else : ?>
     276<p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
     277<?php endif; ?>
    272278<?php
    273279}
     
    308314            </ul>
    309315        </div>
    310 
     316    <?php if ( !current_user_can($tax->assign_cap) ) : ?>
     317    <p><em><?php _e('You cannot modify this Taxonomy.'); ?></em></p>
     318    <?php endif; ?>
    311319    <?php if ( current_user_can($tax->edit_cap) ) : ?>
    312320            <div id="<?php echo $taxonomy; ?>-adder" class="wp-hidden-children">
Note: See TracChangeset for help on using the changeset viewer.