Changeset 18445 for trunk/wp-admin/includes/post.php
- Timestamp:
- 07/20/2011 10:04:35 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r18386 r18445 211 211 if ( $meta->post_id != $post_ID ) 212 212 continue; 213 if ( is_protected_meta( $value['key'] ) )213 if ( is_protected_meta( $value['key'], 'post' ) || ! current_user_can( 'edit_post_meta', $post_ID, $value['key'] ) ) 214 214 continue; 215 215 update_meta( $key, $value['key'], $value['value'] ); … … 223 223 if ( $meta->post_id != $post_ID ) 224 224 continue; 225 if ( is_protected_meta( $meta->meta_key ) )225 if ( is_protected_meta( $meta->meta_key, 'post' ) || ! current_user_can( 'delete_post_meta', $post_ID, $meta->meta_key ) ) 226 226 continue; 227 227 delete_meta( $key ); … … 672 672 $metavalue = trim( $metavalue ); 673 673 674 if ( ('0' === $metavalue || ! empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) {674 if ( ('0' === $metavalue || ! empty ( $metavalue ) ) && ((('#NONE#' != $metakeyselect) && !empty ( $metakeyselect) ) || !empty ( $metakeyinput) ) ) { 675 675 // We have a key/value pair. If both the select and the 676 676 // input for the key have data, the input takes precedence: … … 682 682 $metakey = $metakeyinput; // default 683 683 684 if ( is_protected_meta( $metakey ) )684 if ( is_protected_meta( $metakey, 'post' ) || ! current_user_can( 'add_post_meta', $post_ID, $metakey ) ) 685 685 return false; 686 686 687 wp_cache_delete($post_ID, 'post_meta'); 688 $wpdb->insert( $wpdb->postmeta, array( 'post_id' => $post_ID, 'meta_key' => $metakey, 'meta_value' => $metavalue ) ); 689 $meta_id = $wpdb->insert_id; 690 do_action( 'added_postmeta', $meta_id, $post_ID, $metakey, $metavalue ); 691 692 return $meta_id; 693 } 687 return add_post_meta($post_ID, $metakey, $metavalue); 688 } 689 694 690 return false; 695 691 } // add_meta … … 772 768 FROM $wpdb->postmeta WHERE post_id = %d 773 769 ORDER BY meta_key,meta_id", $postid), ARRAY_A ); 774 775 770 } 776 771 … … 789 784 790 785 $meta_key = stripslashes($meta_key); 791 792 if ( is_protected_meta( $meta_key ) )793 return false;794 786 795 787 if ( '' === trim( $meta_value ) )
Note: See TracChangeset
for help on using the changeset viewer.