<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[24593] trunk: Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/24593">24593</a></dd>
<dt>Author</dt> <dd>nacin</dd>
<dt>Date</dt> <dd>2013-07-08 20:05:42 +0000 (Mon, 08 Jul 2013)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes <a href="http://core.trac.wordpress.org/ticket/23226">#23226</a>.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadminasyncuploadphp">trunk/wp-admin/async-upload.php</a></li>
<li><a href="#trunkwpadmineditphp">trunk/wp-admin/edit.php</a></li>
<li><a href="#trunkwpadminincludesclasswppostslisttablephp">trunk/wp-admin/includes/class-wp-posts-list-table.php</a></li>
<li><a href="#trunkwpadminincludesmediaphp">trunk/wp-admin/includes/media.php</a></li>
<li><a href="#trunkwpadminincludespostphp">trunk/wp-admin/includes/post.php</a></li>
<li><a href="#trunkwpadminincludestemplatephp">trunk/wp-admin/includes/template.php</a></li>
<li><a href="#trunkwpadminpostphp">trunk/wp-admin/post.php</a></li>
<li><a href="#trunkwpincludesadminbarphp">trunk/wp-includes/admin-bar.php</a></li>
<li><a href="#trunkwpincludescapabilitiesphp">trunk/wp-includes/capabilities.php</a></li>
<li><a href="#trunkwpincludesclasswpxmlrpcserverphp">trunk/wp-includes/class-wp-xmlrpc-server.php</a></li>
<li><a href="#trunkwpincludeslinktemplatephp">trunk/wp-includes/link-template.php</a></li>
<li><a href="#trunkwpincludesqueryphp">trunk/wp-includes/query.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadminasyncuploadphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/async-upload.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/async-upload.php  2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/async-upload.php     2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -47,8 +47,7 @@
</span><span class="cx">  $post = get_post( $id );
</span><span class="cx">  if ( 'attachment' != $post->post_type )
</span><span class="cx">          wp_die( __( 'Unknown post type.' ) );
</span><del>-       $post_type_object = get_post_type_object( 'attachment' );
-       if ( ! current_user_can( $post_type_object->cap->edit_post, $id ) )
</del><ins>+        if ( ! current_user_can( 'edit_post', $id ) )
</ins><span class="cx">           wp_die( __( 'You are not allowed to edit this item.' ) );
</span><span class="cx"> 
</span><span class="cx">  switch ( $_REQUEST['fetch'] ) {
</span></span></pre></div>
<a id="trunkwpadmineditphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/edit.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/edit.php  2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/edit.php     2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -78,7 +78,7 @@
</span><span class="cx">                  $trashed = $locked = 0;
</span><span class="cx"> 
</span><span class="cx">                  foreach( (array) $post_ids as $post_id ) {
</span><del>-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
</del><ins>+                                if ( !current_user_can( 'delete_post', $post_id) )
</ins><span class="cx">                                   wp_die( __('You are not allowed to move this item to the Trash.') );
</span><span class="cx"> 
</span><span class="cx">                          if ( wp_check_post_lock( $post_id ) ) {
</span><span class="lines">@@ -97,7 +97,7 @@
</span><span class="cx">          case 'untrash':
</span><span class="cx">                  $untrashed = 0;
</span><span class="cx">                  foreach( (array) $post_ids as $post_id ) {
</span><del>-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
</del><ins>+                                if ( !current_user_can( 'delete_post', $post_id) )
</ins><span class="cx">                                   wp_die( __('You are not allowed to restore this item from the Trash.') );
</span><span class="cx"> 
</span><span class="cx">                          if ( !wp_untrash_post($post_id) )
</span><span class="lines">@@ -112,7 +112,7 @@
</span><span class="cx">                  foreach( (array) $post_ids as $post_id ) {
</span><span class="cx">                          $post_del = get_post($post_id);
</span><span class="cx"> 
</span><del>-                               if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
</del><ins>+                                if ( !current_user_can( 'delete_post', $post_id ) )
</ins><span class="cx">                                   wp_die( __('You are not allowed to delete this item.') );
</span><span class="cx"> 
</span><span class="cx">                          if ( $post_del->post_type == 'attachment' ) {
</span></span></pre></div>
<a id="trunkwpadminincludesclasswppostslisttablephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/class-wp-posts-list-table.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/class-wp-posts-list-table.php    2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/includes/class-wp-posts-list-table.php       2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -480,7 +480,7 @@
</span><span class="cx">          $edit_link = get_edit_post_link( $post->ID );
</span><span class="cx">          $title = _draft_or_post_title();
</span><span class="cx">          $post_type_object = get_post_type_object( $post->post_type );
</span><del>-               $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
</del><ins>+                $can_edit_post = current_user_can( 'edit_post', $post->ID );
</ins><span class="cx"> 
</span><span class="cx">          $alternate = 'alternate' == $alternate ? '' : 'alternate';
</span><span class="cx">          $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
</span><span class="lines">@@ -585,7 +585,7 @@
</span><span class="cx">                                  $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
</span><span class="cx">                                  $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
</span><span class="cx">                          }
</span><del>-                               if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
</del><ins>+                                if ( current_user_can( 'delete_post', $post->ID ) ) {
</ins><span class="cx">                                   if ( 'trash' == $post->post_status )
</span><span class="cx">                                          $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
</span><span class="cx">                                  elseif ( EMPTY_TRASH_DAYS )
</span></span></pre></div>
<a id="trunkwpadminincludesmediaphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/media.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/media.php        2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/includes/media.php   2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -496,9 +496,8 @@
</span><span class="cx"> 
</span><span class="cx">  if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
</span><span class="cx">          $post = $_post = get_post($attachment_id, ARRAY_A);
</span><del>-               $post_type_object = get_post_type_object( $post[ 'post_type' ] );
</del><span class="cx"> 
</span><del>-               if ( !current_user_can( $post_type_object->cap->edit_post, $attachment_id ) )
</del><ins>+                if ( !current_user_can( 'edit_post', $attachment_id ) )
</ins><span class="cx">                   continue;
</span><span class="cx"> 
</span><span class="cx">          if ( isset($attachment['post_content']) )
</span></span></pre></div>
<a id="trunkwpadminincludespostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/post.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/post.php 2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/includes/post.php    2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -28,7 +28,7 @@
</span><span class="cx"> 
</span><span class="cx">  $ptype = get_post_type_object( $post_data['post_type'] );
</span><span class="cx"> 
</span><del>-       if ( $update && ! current_user_can( $ptype->cap->edit_post, $post_data['ID'] ) ) {
</del><ins>+        if ( $update && ! current_user_can( 'edit_post', $post_data['ID'] ) ) {
</ins><span class="cx">           if ( 'page' == $post_data['post_type'] )
</span><span class="cx">                  return new WP_Error( 'edit_others_pages', __( 'You are not allowed to edit pages as this user.' ) );
</span><span class="cx">          else
</span><span class="lines">@@ -172,7 +172,7 @@
</span><span class="cx">  $post_data['post_mime_type'] = $post->post_mime_type;
</span><span class="cx"> 
</span><span class="cx">  $ptype = get_post_type_object($post_data['post_type']);
</span><del>-       if ( !current_user_can( $ptype->cap->edit_post, $post_ID ) ) {
</del><ins>+        if ( !current_user_can( 'edit_post', $post_ID ) ) {
</ins><span class="cx">           if ( 'page' == $post_data['post_type'] )
</span><span class="cx">                  wp_die( __('You are not allowed to edit this page.' ));
</span><span class="cx">          else
</span><span class="lines">@@ -374,7 +374,7 @@
</span><span class="cx">  foreach ( $post_IDs as $post_ID ) {
</span><span class="cx">          $post_type_object = get_post_type_object( get_post_type( $post_ID ) );
</span><span class="cx"> 
</span><del>-               if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( $post_type_object->cap->edit_post, $post_ID ) ) {
</del><ins>+                if ( !isset( $post_type_object ) || ( isset($children) && in_array($post_ID, $children) ) || !current_user_can( 'edit_post', $post_ID ) ) {
</ins><span class="cx">                   $skipped[] = $post_ID;
</span><span class="cx">                  continue;
</span><span class="cx">          }
</span></span></pre></div>
<a id="trunkwpadminincludestemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/template.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/template.php     2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/includes/template.php        2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx">  */
</span><span class="cx"> function get_inline_data($post) {
</span><span class="cx">  $post_type_object = get_post_type_object($post->post_type);
</span><del>-       if ( ! current_user_can($post_type_object->cap->edit_post, $post->ID) )
</del><ins>+        if ( ! current_user_can( 'edit_post', $post->ID ) )
</ins><span class="cx">           return;
</span><span class="cx"> 
</span><span class="cx">  $title = esc_textarea( trim( $post->post_title ) );
</span></span></pre></div>
<a id="trunkwpadminpostphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/post.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/post.php  2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-admin/post.php     2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -139,7 +139,7 @@
</span><span class="cx">  if ( ! $post_type_object )
</span><span class="cx">          wp_die( __( 'Unknown post type.' ) );
</span><span class="cx"> 
</span><del>-       if ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
</del><ins>+        if ( ! current_user_can( 'edit_post', $post_id ) )
</ins><span class="cx">           wp_die( __( 'You are not allowed to edit this item.' ) );
</span><span class="cx"> 
</span><span class="cx">  if ( 'trash' == $post->post_status )
</span><span class="lines">@@ -235,7 +235,7 @@
</span><span class="cx">  if ( ! $post_type_object )
</span><span class="cx">          wp_die( __( 'Unknown post type.' ) );
</span><span class="cx"> 
</span><del>-       if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
</del><ins>+        if ( ! current_user_can( 'delete_post', $post_id ) )
</ins><span class="cx">           wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
</span><span class="cx"> 
</span><span class="cx">  if ( $user_id = wp_check_post_lock( $post_id ) ) {
</span><span class="lines">@@ -259,7 +259,7 @@
</span><span class="cx">  if ( ! $post_type_object )
</span><span class="cx">          wp_die( __( 'Unknown post type.' ) );
</span><span class="cx"> 
</span><del>-       if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
</del><ins>+        if ( ! current_user_can( 'delete_post', $post_id ) )
</ins><span class="cx">           wp_die( __( 'You are not allowed to move this item out of the Trash.' ) );
</span><span class="cx"> 
</span><span class="cx">  if ( ! wp_untrash_post( $post_id ) )
</span><span class="lines">@@ -278,7 +278,7 @@
</span><span class="cx">  if ( ! $post_type_object )
</span><span class="cx">          wp_die( __( 'Unknown post type.' ) );
</span><span class="cx"> 
</span><del>-       if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
</del><ins>+        if ( ! current_user_can( 'delete_post', $post_id ) )
</ins><span class="cx">           wp_die( __( 'You are not allowed to delete this item.' ) );
</span><span class="cx"> 
</span><span class="cx">  $force = ! EMPTY_TRASH_DAYS;
</span></span></pre></div>
<a id="trunkwpincludesadminbarphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/admin-bar.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/admin-bar.php  2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-includes/admin-bar.php     2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -429,7 +429,7 @@
</span><span class="cx">          if ( 'post' == $current_screen->base
</span><span class="cx">                  && 'add' != $current_screen->action
</span><span class="cx">                  && ( $post_type_object = get_post_type_object( $post->post_type ) )
</span><del>-                       && current_user_can( $post_type_object->cap->read_post, $post->ID )
</del><ins>+                        && current_user_can( 'read_post', $post->ID )
</ins><span class="cx">                   && ( $post_type_object->public )
</span><span class="cx">                  && ( $post_type_object->show_in_admin_bar ) )
</span><span class="cx">          {
</span><span class="lines">@@ -457,7 +457,7 @@
</span><span class="cx"> 
</span><span class="cx">          if ( ! empty( $current_object->post_type )
</span><span class="cx">                  && ( $post_type_object = get_post_type_object( $current_object->post_type ) )
</span><del>-                       && current_user_can( $post_type_object->cap->edit_post, $current_object->ID )
</del><ins>+                        && current_user_can( 'edit_post', $current_object->ID )
</ins><span class="cx">                   && $post_type_object->show_ui && $post_type_object->show_in_admin_bar )
</span><span class="cx">          {
</span><span class="cx">                  $wp_admin_bar->add_menu( array(
</span></span></pre></div>
<a id="trunkwpincludescapabilitiesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/capabilities.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/capabilities.php       2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-includes/capabilities.php  2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -1162,8 +1162,7 @@
</span><span class="cx">  case 'delete_post_meta':
</span><span class="cx">  case 'add_post_meta':
</span><span class="cx">          $post = get_post( $args[0] );
</span><del>-               $post_type_object = get_post_type_object( $post->post_type );
-               $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
</del><ins>+                $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
</ins><span class="cx"> 
</span><span class="cx">          $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false;
</span><span class="cx"> 
</span><span class="lines">@@ -1178,9 +1177,7 @@
</span><span class="cx">  case 'edit_comment':
</span><span class="cx">          $comment = get_comment( $args[0] );
</span><span class="cx">          $post = get_post( $comment->comment_post_ID );
</span><del>-               $post_type_object = get_post_type_object( $post->post_type );
-
-               $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
</del><ins>+                $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
</ins><span class="cx">           break;
</span><span class="cx">  case 'unfiltered_upload':
</span><span class="cx">          if ( defined('ALLOW_UNFILTERED_UPLOADS') && ALLOW_UNFILTERED_UPLOADS && ( !is_multisite() || is_super_admin( $user_id ) )  )
</span></span></pre></div>
<a id="trunkwpincludesclasswpxmlrpcserverphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/class-wp-xmlrpc-server.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/class-wp-xmlrpc-server.php     2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-includes/class-wp-xmlrpc-server.php        2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -1017,7 +1017,7 @@
</span><span class="cx">          if ( $update ) {
</span><span class="cx">                  if ( ! get_post( $post_data['ID'] ) )
</span><span class="cx">                          return new IXR_Error( 401, __( 'Invalid post ID.' ) );
</span><del>-                       if ( ! current_user_can( $post_type->cap->edit_post, $post_data['ID'] ) )
</del><ins>+                        if ( ! current_user_can( 'edit_post', $post_data['ID'] ) )
</ins><span class="cx">                           return new IXR_Error( 401, __( 'Sorry, you are not allowed to edit this post.' ) );
</span><span class="cx">                  if ( $post_data['post_type'] != get_post_type( $post_data['ID'] ) )
</span><span class="cx">                          return new IXR_Error( 401, __( 'The post type may not be changed.' ) );
</span><span class="lines">@@ -1327,8 +1327,7 @@
</span><span class="cx">          if ( empty( $post['ID'] ) )
</span><span class="cx">                  return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx"> 
</span><del>-               $post_type = get_post_type_object( $post['post_type'] );
-               if ( ! current_user_can( $post_type->cap->delete_post, $post_id ) )
</del><ins>+                if ( ! current_user_can( 'delete_post', $post_id ) )
</ins><span class="cx">                   return new IXR_Error( 401, __( 'Sorry, you are not allowed to delete this post.' ) );
</span><span class="cx"> 
</span><span class="cx">          $result = wp_delete_post( $post_id );
</span><span class="lines">@@ -1409,8 +1408,7 @@
</span><span class="cx">          if ( empty( $post['ID'] ) )
</span><span class="cx">                  return new IXR_Error( 404, __( 'Invalid post ID.' ) );
</span><span class="cx"> 
</span><del>-               $post_type = get_post_type_object( $post['post_type'] );
-               if ( ! current_user_can( $post_type->cap->edit_post, $post_id ) )
</del><ins>+                if ( ! current_user_can( 'edit_post', $post_id ) )
</ins><span class="cx">                   return new IXR_Error( 401, __( 'Sorry, you cannot edit this post.' ) );
</span><span class="cx"> 
</span><span class="cx">          return $this->_prepare_post( $post, $fields );
</span><span class="lines">@@ -1505,8 +1503,7 @@
</span><span class="cx">          $struct = array();
</span><span class="cx"> 
</span><span class="cx">          foreach ( $posts_list as $post ) {
</span><del>-                       $post_type = get_post_type_object( $post['post_type'] );
-                       if ( ! current_user_can( $post_type->cap->edit_post, $post['ID'] ) )
</del><ins>+                        if ( ! current_user_can( 'edit_post', $post['ID'] ) )
</ins><span class="cx">                           continue;
</span><span class="cx"> 
</span><span class="cx">                  $struct[] = $this->_prepare_post( $post, $fields );
</span></span></pre></div>
<a id="trunkwpincludeslinktemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/link-template.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/link-template.php      2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-includes/link-template.php 2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -906,7 +906,7 @@
</span><span class="cx">  if ( !$post_type_object )
</span><span class="cx">          return;
</span><span class="cx"> 
</span><del>-       if ( !current_user_can( $post_type_object->cap->edit_post, $post->ID ) )
</del><ins>+        if ( !current_user_can( 'edit_post', $post->ID ) )
</ins><span class="cx">           return;
</span><span class="cx"> 
</span><span class="cx">  return apply_filters( 'get_edit_post_link', admin_url( sprintf($post_type_object->_edit_link . $action, $post->ID) ), $post->ID, $context );
</span><span class="lines">@@ -960,7 +960,7 @@
</span><span class="cx">  if ( !$post_type_object )
</span><span class="cx">          return;
</span><span class="cx"> 
</span><del>-       if ( !current_user_can( $post_type_object->cap->delete_post, $post->ID ) )
</del><ins>+        if ( !current_user_can( 'delete_post', $post->ID ) )
</ins><span class="cx">           return;
</span><span class="cx"> 
</span><span class="cx">  $action = ( $force_delete || !EMPTY_TRASH_DAYS ) ? 'delete' : 'trash';
</span></span></pre></div>
<a id="trunkwpincludesqueryphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-includes/query.php (24592 => 24593)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-includes/query.php      2013-07-08 18:58:16 UTC (rev 24592)
+++ trunk/wp-includes/query.php 2013-07-08 20:05:42 UTC (rev 24593)
</span><span class="lines">@@ -2440,14 +2440,13 @@
</span><span class="cx">                  $post_type_object = get_post_type_object ( 'post' );
</span><span class="cx">          }
</span><span class="cx"> 
</span><ins>+               $edit_cap = 'edit_post';
+               $read_cap = 'read_post';
+
</ins><span class="cx">           if ( ! empty( $post_type_object ) ) {
</span><del>-                       $edit_cap = $post_type_object->cap->edit_post;
-                       $read_cap = $post_type_object->cap->read_post;
</del><span class="cx">                   $edit_others_cap = $post_type_object->cap->edit_others_posts;
</span><span class="cx">                  $read_private_cap = $post_type_object->cap->read_private_posts;
</span><span class="cx">          } else {
</span><del>-                       $edit_cap = 'edit_' . $post_type_cap;
-                       $read_cap = 'read_' . $post_type_cap;
</del><span class="cx">                   $edit_others_cap = 'edit_others_' . $post_type_cap . 's';
</span><span class="cx">                  $read_private_cap = 'read_private_' . $post_type_cap . 's';
</span><span class="cx">          }
</span></span></pre>
</div>
</div>

</body>
</html>