[wp-trac] [WordPress Trac] #7299: AtomPub: Draft posts cannot be
edited without turning them published
WordPress Trac
wp-trac at lists.automattic.com
Tue Jul 15 04:39:30 GMT 2008
#7299: AtomPub: Draft posts cannot be edited without turning them published
------------------------+---------------------------------------------------
Reporter: redsweater | Owner: josephscott
Type: defect | Status: new
Priority: high | Milestone: 2.7
Component: XML-RPC | Version: 2.6
Severity: normal | Keywords:
------------------------+---------------------------------------------------
The logic in put_post, in wp-app.php correctly extracts a "publish" or
"draft" status for a post by looking for a draft entry in the supplied
post. If there is one, and it specifies "yes", then the updated entry
should be set to "Unpublished" - otherwise it should be published.
The problem is with some seemingly unnecessary and flawed code which later
overrides that determination with some faulty logic:
// let's not go backwards and make something draft again.
if(!$publish && $post_status == 'draft') {
$post_status = ($publish) ? 'publish' : 'draft';
} elseif($publish) {
$post_status = 'publish';
}
See how it relies on an unset $post_status field, which hasn't been set in
this function. Furthermore, the logic is flawed because in the case where
!$publish is true, it goes on to test for ($publish) being true.
I don't think this faulty logic belongs in here at all. What it does in my
tests is always overrides the post_status to be 'publish', no matter what
the client has specified.
Patch attached to use the basic, good logic as the sole determination for
publish status of the post.
--
Ticket URL: <http://trac.wordpress.org/ticket/7299>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list