Make WordPress Core


Ignore:
Timestamp:
01/26/2010 11:32:04 AM (15 years ago)
Author:
dd32
Message:

First scratch at Taxonomy Capabilities. See #12035

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/edit-tags.php

    r12818 r12833  
    1919if ( !is_taxonomy($taxonomy) )
    2020    wp_die(__('Invalid taxonomy'));
     21
     22$tax = get_taxonomy($taxonomy);
    2123
    2224if ( empty($post_type) || !in_array( $post_type, get_post_types( array('_show' => true) ) ) )
     
    4042    check_admin_referer('add-tag');
    4143
    42     if ( !current_user_can('manage_categories') )
     44    if ( !current_user_can($tax->edit_cap) )
    4345        wp_die(__('Cheatin’ uh?'));
    4446
     
    6163    check_admin_referer('delete-tag_' .  $tag_ID);
    6264
    63     if ( !current_user_can('manage_categories') )
     65    if ( !current_user_can($tax->delete_cap) )
    6466        wp_die(__('Cheatin’ uh?'));
    6567
     
    8183    check_admin_referer('bulk-tags');
    8284
    83     if ( !current_user_can('manage_categories') )
     85    if ( !current_user_can($tax->delete_cap) )
    8486        wp_die(__('Cheatin’ uh?'));
    8587
     
    116118    check_admin_referer('update-tag_' . $tag_ID);
    117119
    118     if ( !current_user_can('manage_categories') )
     120    if ( !current_user_can($tax->edit_cap) )
    119121        wp_die(__('Cheatin’ uh?'));
    120122
     
    143145}
    144146
    145 $can_manage = current_user_can('manage_categories');
    146 
    147147wp_enqueue_script('admin-tags');
    148 if ( $can_manage )
     148if ( current_user_can($tax->edit_cap) )
    149149    wp_enqueue_script('inline-edit-tax');
    150150
     
    250250
    251251    <tbody id="the-list" class="list:tag">
    252 <?php
    253 
    254 $count = tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy );
    255 ?>
     252<?php tag_rows( $pagenum, $tags_per_page, $searchterms, $taxonomy ); ?>
    256253    </tbody>
    257254</table>
     
    285282<h3><?php _e('Popular Tags'); ?></h3>
    286283<?php
    287 if ( $can_manage )
     284if ( current_user_can($tax->edit_cap) )
    288285    wp_tag_cloud(array('taxonomy' => $taxonomy, 'link' => 'edit'));
    289286else
     
    292289</div>
    293290
    294 <?php if ( $can_manage ) {
    295     do_action('add_tag_form_pre'); ?>
     291<?php if ( current_user_can($tax->edit_cap) ) {
     292    do_action('add_tag_form_pre', $taxonomy); ?>
    296293
    297294<div class="form-wrap">
     
    328325
    329326<p class="submit"><input type="submit" class="button" name="submit" id="submit" value="<?php esc_attr_e('Add Tag'); ?>" /></p>
    330 <?php do_action('add_tag_form'); ?>
     327<?php do_action('add_tag_form', $taxonomy); ?>
    331328</form></div>
    332329<?php } ?>
Note: See TracChangeset for help on using the changeset viewer.