[wp-trac] [WordPress Trac] #4669: Atom-PP implmenetation does not show draft entries

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 24 16:19:12 GMT 2007


#4669: Atom-PP implmenetation does not show draft entries
---------------------+------------------------------------------------------
 Reporter:  placey   |       Owner:  anonymous        
     Type:  defect   |      Status:  new              
 Priority:  normal   |   Milestone:                   
Component:  General  |     Version:  2.2              
 Severity:  normal   |    Keywords:  app atom-pp draft
---------------------+------------------------------------------------------
 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);
 }}}

-- 
Ticket URL: <http://trac.wordpress.org/ticket/4669>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list