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
This commit is contained in:
parent
72f9ff6ec0
commit
48c873e2fa
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue