Fix for assigning authors - http://mosquito.wordpress.org/view.php?id=759
git-svn-id: http://svn.automattic.com/wordpress/trunk@2172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ca2815fb70
commit
c4d8b5c8b4
|
@ -44,6 +44,16 @@ case 'post':
|
||||||
if ( isset($_POST['menu_order']) )
|
if ( isset($_POST['menu_order']) )
|
||||||
$menu_order = $_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) )
|
if ( empty($post_status) )
|
||||||
$post_status = 'draft';
|
$post_status = 'draft';
|
||||||
// Double-check
|
// Double-check
|
||||||
|
@ -97,7 +107,7 @@ case 'post':
|
||||||
$postquery ="INSERT INTO $wpdb->posts
|
$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)
|
(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
|
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);
|
$result = $wpdb->query($postquery);
|
||||||
|
|
Loading…
Reference in New Issue