mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
"Trash" updates, props caesarsgrunt, see #4529
git-svn-id: https://develop.svn.wordpress.org/trunk@11841 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -827,11 +827,16 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
// If the user is the author...
|
||||
if ( $user_id == $post_author_data->ID ) {
|
||||
// If the post is published...
|
||||
if ( 'publish' == $post->post_status )
|
||||
if ( 'publish' == $post->post_status ) {
|
||||
$caps[] = 'edit_published_posts';
|
||||
else
|
||||
} elseif ( 'trash' == $post->post_status ) {
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if ( is_array($trash_meta) && isset($trash_meta['posts'][$post->ID]['status']) && $trash_meta['posts'][$post->ID]['status'] == 'publish' )
|
||||
$caps[] = 'edit_published_posts';
|
||||
} else {
|
||||
// If the post is draft...
|
||||
$caps[] = 'edit_posts';
|
||||
}
|
||||
} else {
|
||||
// The user is trying to edit someone else's post.
|
||||
$caps[] = 'edit_others_posts';
|
||||
@@ -851,11 +856,16 @@ function map_meta_cap( $cap, $user_id ) {
|
||||
// If the user is the author...
|
||||
if ( $user_id == $page_author_data->ID ) {
|
||||
// If the page is published...
|
||||
if ( 'publish' == $page->post_status )
|
||||
if ( 'publish' == $page->post_status ) {
|
||||
$caps[] = 'edit_published_pages';
|
||||
else
|
||||
} elseif ( 'trash' == $page->post_status ) {
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if ( is_array($trash_meta) && isset($trash_meta['posts'][$page->ID]['status']) && $trash_meta['posts'][$page->ID]['status'] == 'publish' )
|
||||
$caps[] = 'edit_published_pages';
|
||||
} else {
|
||||
// If the page is draft...
|
||||
$caps[] = 'edit_pages';
|
||||
}
|
||||
} else {
|
||||
// The user is trying to edit someone else's page.
|
||||
$caps[] = 'edit_others_pages';
|
||||
|
||||
@@ -78,7 +78,7 @@ function prepareMediaItemInit(fileObj) {
|
||||
// Tell the server to delete it. TODO: handle exceptions
|
||||
jQuery.ajax({url:'admin-ajax.php',type:'post',success:deleteSuccess,error:deleteError,id:fileObj.id,data:{
|
||||
id : this.id.replace(/[^0-9]/g,''),
|
||||
action : 'delete-post',
|
||||
action : 'trash-post',
|
||||
_ajax_nonce : this.href.replace(/^.*wpnonce=/,'')}
|
||||
});
|
||||
return false;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1264,7 +1264,7 @@ function wp_untrash_post($postid = 0) {
|
||||
|
||||
do_action('untrash_post', $postid);
|
||||
|
||||
$post['post_status'] = 'draft';
|
||||
$post['post_status'] = ($post->post_type == 'attachment') ? 'inherit' : 'draft';
|
||||
|
||||
$trash_meta = get_option('wp_trash_meta');
|
||||
if ( is_array($trash_meta) && isset($trash_meta['posts'][$postid]) ) {
|
||||
|
||||
@@ -186,7 +186,7 @@ function wp_default_scripts( &$scripts ) {
|
||||
$scripts->add( 'swfupload-all', '/wp-includes/js/swfupload/swfupload-all.js', array(), '2201');
|
||||
}
|
||||
|
||||
$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090515');
|
||||
$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20090818');
|
||||
// these error messages came from the sample swfupload js, they might need changing.
|
||||
$scripts->localize( 'swfupload-handlers', 'swfuploadL10n', array(
|
||||
'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
|
||||
|
||||
Reference in New Issue
Block a user