From 48c873e2fa42fb888f550c00b825b7a87ed5b860 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Mon, 31 Jan 2005 10:32:28 +0000 Subject: [PATCH] Fix for assigning authors - http://mosquito.wordpress.org/view.php?id=759 git-svn-id: https://develop.svn.wordpress.org/trunk@2172 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/post.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/wp-admin/post.php b/wp-admin/post.php index c0753539cb..8f257615f5 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -44,6 +44,16 @@ case 'post': if ( isset($_POST['menu_order']) ) $menu_order = $_POST['menu_order']; + if (! empty($_POST['post_author_override'])) { + $post_author = (int) $_POST['post_author_override']; + } else if (! empty($_POST['post_author'])) { + $post_author = (int) $_POST['post_author']; + } else { + $post_author = (int) $_POST['user_ID']; + } + if ( !user_can_edit_user($user_ID, $post_author) ) + die( __('You cannot post as this user.') ); + if ( empty($post_status) ) $post_status = 'draft'; // Double-check @@ -97,7 +107,7 @@ case 'post': $postquery ="INSERT INTO $wpdb->posts (ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt, post_parent, menu_order) VALUES - ('$post_ID', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt', '$post_parent', '$menu_order') + ('$post_ID', '$post_author', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt', '$post_parent', '$menu_order') "; $result = $wpdb->query($postquery);