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/includes/template.php

    r12818 r12833  
    212212function inline_edit_term_row($type, $taxonomy) {
    213213
    214     if ( ! current_user_can( 'manage_categories' ) )
     214    $tax = get_taxonomy($taxonomy);
     215    if ( ! current_user_can( $tax->edit_cap ) )
    215216        return;
    216217
     
    679680        else
    680681            $tagsel = $taxonomy;
     682
     683        $tax = get_taxonomy($taxonomy);
     684
    681685        $count = ( $count > 0 ) ? "<a href='edit.php?$tagsel=$tag->slug'>$count</a>" : $count;
    682686
     
    685689        $qe_data = get_term($tag->term_id, $taxonomy, object, 'edit');
    686690        $edit_link = "edit-tags.php?action=edit&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id";
     691
    687692        $out = '';
    688693        $out .= '<tr id="tag-' . $tag->term_id . '"' . $class . '>';
     694
    689695        $columns = get_column_headers('edit-tags');
    690696        $hidden = get_hidden_columns('edit-tags');
     697        $default_term = get_option('default_' . $taxonomy);
    691698        foreach ( $columns as $column_name => $column_display_name ) {
    692699            $class = "class=\"$column_name column-$column_name\"";
     
    700707            switch ($column_name) {
    701708                case 'cb':
    702                     if ( $tag->term_id != get_option('default_' . $taxonomy) )
     709                    if ( current_user_can($tax->delete_cap) && $tag->term_id != $default_term )
    703710                        $out .= '<th scope="row" class="check-column"> <input type="checkbox" name="delete_tags[]" value="' . $tag->term_id . '" /></th>';
    704711                    else
     
    708715                    $out .= '<td ' . $attributes . '><strong><a class="row-title" href="' . $edit_link . '" title="' . esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $name)) . '">' . $name . '</a></strong><br />';
    709716                    $actions = array();
    710                     $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
    711                     $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
    712                     if ( $tag->term_id != get_option('default_' . $taxonomy) )
     717                    if ( current_user_can($tax->edit_cap) ) {
     718                        $actions['edit'] = '<a href="' . $edit_link . '">' . __('Edit') . '</a>';
     719                        $actions['inline hide-if-no-js'] = '<a href="#" class="editinline">' . __('Quick&nbsp;Edit') . '</a>';
     720                    }
     721                    if ( current_user_can($tax->delete_cap) && $tag->term_id != $default_term )
    713722                        $actions['delete'] = "<a class='delete-tag' href='" . wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id) . "'>" . __('Delete') . "</a>";
    714723
     
    747756        }
    748757
    749         $out .= '</tr>';
     758        $out .= "</tr>\n";
    750759
    751760        return $out;
     
    796805    }
    797806
    798     // filter and send to screen
    799807    echo $out;
    800808    return $count;
     
    11361144
    11371145    <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
    1138         <h4><?php echo $bulk ? ( __( 'Bulk Edit' ) ) : __( 'Quick Edit' ); ?></h4>
     1146        <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
    11391147
    11401148
Note: See TracChangeset for help on using the changeset viewer.