WordPress.org

Make WordPress Core

Changeset 13289


Ignore:
Timestamp:
02/22/2010 08:36:32 AM (8 years ago)
Author:
dd32
Message:

Introduce assign_cap for Taxonomies, Defaults to 'edit_posts'. Allows for Authors/Contributors to tag/categorise their posts. See #12035

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-ajax.php

    r13285 r13289  
    209209    $taxonomy = get_taxonomy(substr($action, 4));
    210210    check_ajax_referer( $action );
    211     if ( !current_user_can( $taxonomy->manage_cap ) )
     211    if ( !current_user_can( $taxonomy->edit_cap ) )
    212212        die('-1');
    213213    $names = explode(',', $_POST['new'.$taxonomy->name]);
  • trunk/wp-admin/includes/meta-boxes.php

    r13285 r13289  
    248248    $tax_name = esc_attr(substr($box['id'], 8));
    249249    $taxonomy = get_taxonomy($tax_name);
    250     if ( !current_user_can($taxonomy->manage_cap) ) // @todo: Display the terms, do not edit.
     250    if ( !current_user_can($taxonomy->assign_cap) ) // @todo: Display the terms, do not edit.
    251251        return;
    252252    $helps = isset($taxonomy->helps) ? esc_attr($taxonomy->helps) : __('Separate tags with commas.');
  • trunk/wp-admin/includes/template.php

    r13288 r13289  
    316316
    317317    $tax = get_taxonomy($taxonomy);
    318     $args['disabled'] = !current_user_can($tax->manage_cap);
     318    $args['disabled'] = !current_user_can($tax->assign_cap);
    319319
    320320    if ( is_array( $selected_cats ) )
     
    379379
    380380    $tax = get_taxonomy($taxonomy);
    381     if ( ! current_user_can($tax->manage_cap) )
     381    if ( ! current_user_can($tax->assign_cap) )
    382382        $disabled = 'disabled="disabled"';
    383383    else
  • trunk/wp-includes/post.php

    r13284 r13289  
    21862186        foreach ( $tax_input as $taxonomy => $tags ) {
    21872187            $taxonomy_obj = get_taxonomy($taxonomy);
    2188             if ( current_user_can($taxonomy_obj->manage_cap) )
     2188            if ( current_user_can($taxonomy_obj->assign_cap) )
    21892189                wp_set_post_terms( $post_ID, $tags, $taxonomy );
    21902190        }
  • trunk/wp-includes/taxonomy.php

    r13284 r13289  
    257257            $args[$cap] = 'manage_categories';
    258258    }
     259    if ( empty($args['assign_cap']) )
     260        $args['assign_cap'] = 'edit_posts';
    259261
    260262    if ( empty($args['singular_label']) )
Note: See TracChangeset for help on using the changeset viewer.