WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#9200 closed defect (bug) (duplicate)

comment widget links draft articles

Reported by: hakre Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: General Keywords:
Focuses: Cc:

Description

the wp 2.7.1 standard widget for the latest comments lists comments that are posted to a draft article. if the link is clicked, wordpress does not display the article because it is in draft state.

reproduceablity: every time.

how: create an article, plublish it, comment it, set the articles state to draft.

Change History (9)

comment:1 mrmist5 years ago

This has been raised before. I'm pretty sure it was closed as wontfix last time, because in order to create the "bug" you have to publish an article, wait for comments on it, and then set that article to draft status, which is really odd workflow.

comment:2 FFEMTcJ5 years ago

  • Milestone 2.7.2 deleted
  • Resolution set to wontfix
  • Status changed from new to closed

comment:3 hakre5 years ago

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Please provide a link to the duplicate, would like to see that.

The level of manual interaction with the software WordPress should not be an argument against the fact, that it is a bug. At least it isn't from my point of view.

I did report the ticket here to send in a patch by myself because this single incidence I reported here already shows that the checks performed in the widget are not fully reflecting the underlying database structure.

So for better reference, please provide a link to the other ticket you were writing about and I re-open it because I plan to fix it, even though you might not want to fix it, because you trust all users input.

Thanks for your cooperation.

comment:4 hakre5 years ago

Just took a look in the source: Nothing is checked in the widgets, it's aboslutely independent from the posts table, it's onyl about comments.

information about posts is looked up only afterwards while iterating over the results from the comments database queries.

what is needed is a join on the posts table to gain the posts status for the post the comment is related to.

luckily comment_post_ID and post_status are indexed so that using a join in this query should do the job without any further notice. only a check for post_status: 'draft' has to be added.

next to patching the database query a fix for the user would be to set the comments not being approved (comment_approved: '0'). this could be done just in case in the article editor while saving a draft.

the last might be a nicer fix then changing the query in the widget.

comment:5 menelicte5 years ago

If you take a look to my solution for the similar problem with 'private' entries (http://core.trac.wordpress.org/ticket/9211), you'll see I took a look to your ticket.

I think that what you need could be done by adding

AND p.post_status<>'draft'

in the WHERE clause of the query I modified in the other ticket.

comment:6 mrmist5 years ago

See #8169 previously closed by Ryan.

I think the wontfix was right. I disagree with increasing the cost of the query that produces the widget for an edge-case like this. Your editors should be attending to the workflow, rather than having the software jump through hoops.

comment:7 mrmist5 years ago

  • Resolution set to duplicate
  • Status changed from reopened to closed

Patch attached to #9211

Closing this as a dupe of that, as they both deal with the same thing.

comment:8 hakre5 years ago

Thanks.

comment:9 voyagerfan57614 years ago

  • Cc WordPress@… added
Note: See TracTickets for help on using tickets.