Ticket #16714: 16714.2.diff
File 16714.2.diff, 16.6 KB (added by , 13 years ago) |
---|
-
wp-admin/edit.php
20 20 21 21 $post_type_object = get_post_type_object( $post_type ); 22 22 23 if ( !current_user_can($post_type_object->cap-> edit_posts) )23 if ( !current_user_can($post_type_object->cap->create_posts) ) 24 24 wp_die(__('Cheatin’ uh?')); 25 25 26 26 $wp_list_table = _get_list_table('WP_Posts_List_Table'); … … 190 190 ?> 191 191 <div class="wrap"> 192 192 <?php screen_icon(); ?> 193 <h2><?php echo esc_html( $post_type_object->labels->name ); ?> <a href="<?php echo $post_new_file ?>" class="button add-new-h2"><?php echo esc_html($post_type_object->labels->add_new); ?></a> <?php 194 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 195 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query() ); ?> 193 <h2> 194 <?php 195 echo esc_html( $post_type_object->labels->name ); 196 197 if( current_user_can( $post_type_object->cap->create_posts ) ) 198 echo '<a href="' . $post_new_file . '" class="button add-new-h2">' . esc_html( $post_type_object->labels->add_new ) . '</a>'; 199 200 if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) 201 printf( '<span class="subtitle">' . __('Search results for “%s”') . '</span>', get_search_query() ); 202 ?> 196 203 </h2> 197 204 198 205 <?php -
wp-admin/includes/dashboard.php
65 65 wp_add_dashboard_widget( 'dashboard_plugins', __( 'Plugins' ), 'wp_dashboard_plugins' ); 66 66 67 67 // QuickPress Widget 68 if ( is_blog_admin() && current_user_can(' edit_posts') )68 if ( is_blog_admin() && current_user_can('create_posts') ) 69 69 wp_add_dashboard_widget( 'dashboard_quick_press', __( 'QuickPress' ), 'wp_dashboard_quick_press' ); 70 70 71 71 // Recent Drafts -
wp-admin/includes/post.php
520 520 else 521 521 $ptype = get_post_type_object('post'); 522 522 523 if ( !current_user_can( $ptype->cap-> edit_posts ) ) {523 if ( !current_user_can( $ptype->cap->create_posts ) ) { 524 524 if ( 'page' == $ptype->name ) 525 return new WP_Error( ' edit_pages', __( 'You are not allowed to create pages on this site.' ) );525 return new WP_Error( 'create_pages', __( 'You are not allowed to create pages on this site.' ) ); 526 526 else 527 return new WP_Error( ' edit_posts', __( 'You are not allowed to create posts or drafts on this site.' ) );527 return new WP_Error( 'create_posts', __( 'You are not allowed to create posts or drafts on this site.' ) ); 528 528 } 529 529 530 530 // Check for autosave collisions -
wp-admin/menu.php
65 65 $menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'div' ); 66 66 $submenu['edit.php'][5] = array( __('Posts'), 'edit_posts', 'edit.php' ); 67 67 /* translators: add new post */ 68 $submenu['edit.php'][10] = array( _x('Add New', 'post'), ' edit_posts', 'post-new.php' );68 $submenu['edit.php'][10] = array( _x('Add New', 'post'), 'create_posts', 'post-new.php' ); 69 69 70 70 $i = 15; 71 71 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { … … 127 127 while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) 128 128 $ptype_menu_position++; 129 129 130 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap-> edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );131 $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap-> edit_posts, "edit.php?post_type=$ptype");132 $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap-> edit_posts, "post-new.php?post_type=$ptype" );130 $menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->create_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon ); 131 $submenu["edit.php?post_type=$ptype"][5] = array( $ptype_obj->labels->menu_name, $ptype_obj->cap->create_posts, "edit.php?post_type=$ptype"); 132 $submenu["edit.php?post_type=$ptype"][10] = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype" ); 133 133 134 134 $i = 15; 135 135 foreach ( get_taxonomies( array(), 'objects' ) as $tax ) { … … 206 206 $submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php'); 207 207 } 208 208 209 $menu[75] = array( __('Tools'), ' edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' );210 $submenu['tools.php'][5] = array( __('Tools'), ' edit_posts', 'tools.php' );209 $menu[75] = array( __('Tools'), 'create_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'div' ); 210 $submenu['tools.php'][5] = array( __('Tools'), 'create_posts', 'tools.php' ); 211 211 $submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' ); 212 212 $submenu['tools.php'][15] = array( __('Export'), 'import', 'export.php' ); 213 213 if ( is_multisite() && !is_main_site() ) -
wp-admin/post-new.php
30 30 31 31 $editing = true; 32 32 33 if ( ! current_user_can( $post_type_object->cap-> edit_posts ) )33 if ( ! current_user_can( $post_type_object->cap->create_posts ) ) 34 34 wp_die( __( 'Cheatin’ uh?' ) ); 35 35 36 36 wp_enqueue_script('autosave'); -
wp-admin/press-this.php
13 13 14 14 header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset')); 15 15 16 if ( ! current_user_can(' edit_posts') )16 if ( ! current_user_can('create_posts') ) 17 17 wp_die( __( 'Cheatin’ uh?' ) ); 18 18 19 19 /** -
wp-admin/tools.php
27 27 <?php screen_icon(); ?> 28 28 <h2><?php echo esc_html( $title ); ?></h2> 29 29 30 <?php if ( current_user_can(' edit_posts') ) : ?>30 <?php if ( current_user_can('create_posts') ) : ?> 31 31 <div class="tool-box"> 32 32 <h3 class="title"><?php _e('Press This') ?></h3> 33 33 <p><?php _e('Press This is a bookmarklet: a little app that runs in your browser and lets you grab bits of the web.');?></p> -
wp-app.php
320 320 function get_service() { 321 321 log_app('function','get_service()'); 322 322 323 if ( !current_user_can( ' edit_posts' ) )323 if ( !current_user_can( 'create_posts' ) ) 324 324 $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); 325 325 326 326 $entries_url = esc_attr($this->get_entries_url()); … … 361 361 function get_categories_xml() { 362 362 log_app('function','get_categories_xml()'); 363 363 364 if ( !current_user_can( ' edit_posts' ) )364 if ( !current_user_can( 'create_posts' ) ) 365 365 $this->auth_required( __( 'Sorry, you do not have the right to access this site.' ) ); 366 366 367 367 $home = esc_attr(get_bloginfo_rss('url')); -
wp-includes/admin-bar.php
123 123 $wp_admin_bar->add_menu( array( 'parent' => 'my-blogs', 'id' => 'blog-' . $blog->userblog_id, 'title' => $blavatar . $blogname, 'href' => get_admin_url($blog->userblog_id) ) ); 124 124 $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-d', 'title' => __( 'Dashboard' ), 'href' => get_admin_url($blog->userblog_id) ) ); 125 125 126 if ( current_user_can_for_blog( $blog->userblog_id, ' edit_posts' ) ) {126 if ( current_user_can_for_blog( $blog->userblog_id, 'create_posts' ) ) { 127 127 $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-n', 'title' => __( 'New Post' ), 'href' => get_admin_url($blog->userblog_id, 'post-new.php') ) ); 128 128 $wp_admin_bar->add_menu( array( 'parent' => 'blog-' . $blog->userblog_id, 'id' => 'blog-' . $blog->userblog_id . '-c', 'title' => __( 'Manage Comments' ), 'href' => get_admin_url($blog->userblog_id, 'edit-comments.php') ) ); 129 129 } … … 186 186 187 187 $actions = array(); 188 188 foreach ( (array) get_post_types( array( 'show_ui' => true ), 'objects' ) as $ptype_obj ) { 189 if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap-> edit_posts ) )189 if ( true !== $ptype_obj->show_in_menu || ! current_user_can( $ptype_obj->cap->create_posts ) ) 190 190 continue; 191 191 192 $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap-> edit_posts, 'new-' . $ptype_obj->name );192 $actions[ 'post-new.php?post_type=' . $ptype_obj->name ] = array( $ptype_obj->labels->singular_name, $ptype_obj->cap->create_posts, 'new-' . $ptype_obj->name ); 193 193 } 194 194 195 195 if ( empty( $actions ) ) … … 210 210 function wp_admin_bar_comments_menu() { 211 211 global $wp_admin_bar; 212 212 213 if ( !current_user_can(' edit_posts') )213 if ( !current_user_can('create_posts') ) 214 214 return; 215 215 216 216 $awaiting_mod = wp_count_comments(); -
wp-includes/capabilities.php
859 859 $caps[] = $post_type->cap->delete_private_posts; 860 860 } 861 861 break; 862 case 'create_posts': 863 $caps[] = 'edit_posts'; 864 break; 862 865 // edit_post breaks down to edit_posts, edit_published_posts, or 863 866 // edit_others_posts 864 867 case 'edit_post': -
wp-includes/class-wp-xmlrpc-server.php
774 774 if ( !$user = $this->login($username, $password) ) 775 775 return $this->error; 776 776 777 if ( !current_user_can(" edit_posts") )778 return(new IXR_Error(401, __("Sorry, you cannot editposts on this site.")));777 if ( !current_user_can("create_posts") ) 778 return(new IXR_Error(401, __("Sorry, you cannot create posts on this site."))); 779 779 780 780 do_action('xmlrpc_call', 'wp.getAuthors'); 781 781 … … 809 809 if ( !$user = $this->login($username, $password) ) 810 810 return $this->error; 811 811 812 if ( !current_user_can( ' edit_posts' ) )813 return new IXR_Error( 401, __( 'Sorry, you must be able to editposts on this site in order to view tags.' ) );812 if ( !current_user_can( 'create_posts' ) ) 813 return new IXR_Error( 401, __( 'Sorry, you must be able to create posts on this site in order to view tags.' ) ); 814 814 815 815 do_action( 'xmlrpc_call', 'wp.getKeywords' ); 816 816 … … 938 938 if ( !$user = $this->login($username, $password) ) 939 939 return $this->error; 940 940 941 if ( !current_user_can( ' edit_posts' ) )942 return new IXR_Error( 401, __( 'Sorry, you must be able to editposts to this site in order to view categories.' ) );941 if ( !current_user_can( 'create_posts' ) ) 942 return new IXR_Error( 401, __( 'Sorry, you must be able to create posts to this site in order to view categories.' ) ); 943 943 944 944 do_action('xmlrpc_call', 'wp.suggestCategories'); 945 945 … … 1310 1310 if ( !$user = $this->login($username, $password) ) 1311 1311 return $this->error; 1312 1312 1313 if ( !current_user_can( ' edit_posts' ) )1313 if ( !current_user_can( 'create_posts' ) ) 1314 1314 return new IXR_Error( 403, __( 'You are not allowed access to details about comments.' ) ); 1315 1315 1316 1316 do_action('xmlrpc_call', 'wp.getCommentCount'); … … 1342 1342 if ( !$user = $this->login($username, $password) ) 1343 1343 return $this->error; 1344 1344 1345 if ( !current_user_can( ' edit_posts' ) )1345 if ( !current_user_can( 'create_posts' ) ) 1346 1346 return new IXR_Error( 403, __( 'You are not allowed access to details about this site.' ) ); 1347 1347 1348 1348 do_action('xmlrpc_call', 'wp.getPostStatusList'); … … 1724 1724 if ( !$user = $this->login($username, $password) ) 1725 1725 return $this->error; 1726 1726 1727 if ( !current_user_can( ' edit_posts' ) )1727 if ( !current_user_can( 'create_posts' ) ) 1728 1728 return new IXR_Error( 401, __( 'Sorry, you do not have access to user data on this site.' ) ); 1729 1729 1730 1730 do_action('xmlrpc_call', 'blogger.getUserInfo'); … … 1945 1945 1946 1946 do_action('xmlrpc_call', 'blogger.newPost'); 1947 1947 1948 $cap = ($publish) ? 'publish_posts' : ' edit_posts';1948 $cap = ($publish) ? 'publish_posts' : 'create_posts'; 1949 1949 if ( !current_user_can($cap) ) 1950 1950 return new IXR_Error(401, __('Sorry, you are not allowed to post on this site.')); 1951 1951 … … 2112 2112 elseif ('publish' == $content_struct['post_status']) 2113 2113 $cap = 'publish_posts'; 2114 2114 else 2115 $cap = ' edit_posts';2115 $cap = 'create_posts'; 2116 2116 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2117 2117 $post_type = 'post'; 2118 2118 } else { … … 2125 2125 elseif ('publish' == $content_struct['post_status']) 2126 2126 $cap = 'publish_posts'; 2127 2127 else 2128 $cap = ' edit_posts';2128 $cap = 'create_posts'; 2129 2129 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2130 2130 $post_type = 'post'; 2131 2131 } … … 2405 2405 2406 2406 do_action('xmlrpc_call', 'metaWeblog.editPost'); 2407 2407 2408 $cap = ( $publish ) ? 'publish_posts' : ' edit_posts';2408 $cap = ( $publish ) ? 'publish_posts' : 'create_posts'; 2409 2409 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2410 2410 $post_type = 'post'; 2411 2411 $page_template = ''; … … 2423 2423 if ( $publish || 'publish' == $content_struct['post_status'] ) 2424 2424 $cap = 'publish_posts'; 2425 2425 else 2426 $cap = ' edit_posts';2426 $cap = 'create_posts'; 2427 2427 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2428 2428 $post_type = 'post'; 2429 2429 } else { … … 2434 2434 if ( $publish || 'publish' == $content_struct['post_status'] ) 2435 2435 $cap = 'publish_posts'; 2436 2436 else 2437 $cap = ' edit_posts';2437 $cap = 'create_posts'; 2438 2438 $error_message = __( 'Sorry, you are not allowed to publish posts on this site.' ); 2439 2439 $post_type = 'post'; 2440 2440 } … … 2909 2909 if ( !$user = $this->login($username, $password) ) 2910 2910 return $this->error; 2911 2911 2912 if ( !current_user_can( ' edit_posts' ) )2913 return new IXR_Error( 401, __( 'Sorry, you must be able to editposts on this site in order to view categories.' ) );2912 if ( !current_user_can( 'create_posts' ) ) 2913 return new IXR_Error( 401, __( 'Sorry, you must be able to create posts on this site in order to view categories.' ) ); 2914 2914 2915 2915 do_action('xmlrpc_call', 'metaWeblog.getCategories'); 2916 2916 … … 3100 3100 if ( !$user = $this->login($username, $password) ) 3101 3101 return $this->error; 3102 3102 3103 if ( !current_user_can( ' edit_posts' ) )3104 return new IXR_Error( 401, __( 'Sorry, you must be able to editposts on this site in order to view categories.' ) );3103 if ( !current_user_can( 'create_posts' ) ) 3104 return new IXR_Error( 401, __( 'Sorry, you must be able to create posts on this site in order to view categories.' ) ); 3105 3105 3106 3106 do_action('xmlrpc_call', 'mt.getCategoryList'); 3107 3107 -
wp-includes/post.php
1086 1086 'read_post' => 'read_' . $singular_base, 1087 1087 'delete_post' => 'delete_' . $singular_base, 1088 1088 // Primitive capabilities used outside of map_meta_cap(): 1089 'edit_posts' => 'edit_' . $plural_base, 1089 'create_posts' => 'create_' . $plural_base, 1090 'edit_posts' => 'edit_' . $plural_base, 1090 1091 'edit_others_posts' => 'edit_others_' . $plural_base, 1091 1092 'publish_posts' => 'publish_' . $plural_base, 1092 1093 'read_private_posts' => 'read_private_' . $plural_base,