Opened 17 years ago
Closed 17 years ago
#4669 closed defect (bug) (fixed)
Atom-PP implmenetation does not show draft entries
Reported by: | placey | Owned by: | |
---|---|---|---|
Milestone: | 2.3 | Priority: | normal |
Severity: | normal | Version: | 2.2 |
Component: | General | Keywords: | app atom-pp draft |
Focuses: | Cc: |
Description
When requesting a feed from wp-app.php only published entries are shown. The problem is in the wa_posts_where_include_drafts_filter
function. The where clause that this function is expecting is post_author = ([0-9]+) AND post_status != 'draft
However, it is actually passed in AND (post_type = 'post' AND (post_status = 'publish'))
. Therefore, the ereg_replace
should be changed to:
$where = str_replace("AND (post_type = 'post' AND (post_status = 'publish'))", "AND post_type = 'post'", $where);
or possibly even:
$where = "AND post_type = 'post'";
Related to this function, but not this bug is that it should probably be the case that drafts are only visible to those who wrote them. Therefore, the where clause should only be changed if the authenticated user has the right permissions, like so:
$cap = ($publish) ? 'publish_posts' : 'edit_posts'; if(!current_user_can($cap)) $where = str_replace("AND (post_type = 'post' AND (post_status = 'publish'))", "AND post_type = 'post'", $where);
Change History (2)
Note: See
TracTickets for help on using
tickets.
Fixed as of revision 5951 of wp-app.php.
See ticket # 4191: http://trac.wordpress.org/ticket/4191