Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#8169 closed defect (bug) (wontfix)

Recent comments for unpublished posts showing at the sidebar

Reported by: mberasategi Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.7
Component: Comments Keywords: comments,
Focuses: Cc:


The recent comments widget is showing comments even from posts marked as unpublished. Moreover the link to the comment shows the unpublished post, which is quite undesirable.

Attachments (1)

awaiting.jpg (89.4 KB) - added by mrmist 7 years ago.

Download all attachments as: .zip

Change History (8)

#1 @Viper007Bond
7 years ago

Why do you have comments on an unpublished post?

The recent comments widget merely shows the latest approved, non-spam comments in the database. Since a post received a comment, it is assumed that the comment has been published.

Checking to see if the post has actually be posted or not would require an extra query per displayed comment (as we'd have to query the parent post) and in 99.9999% of cases, it wouldn't be needed.

Recommend wontfix.

#2 follow-up: @mrmist
7 years ago

The only issue that I can see with it is that it shows the content on comments that are awaiting approval to people who aren't comment moderators.

It does show links to the unpublished article, but the link only functions if you're editor-level or above.

Also for this to happen you'd have to publish a page, recieve a comment on it, then unpublish it, which is a bit odd.

I wouldn't fix this, but I would consider limiting the "recent comments" view to stuff that's been approved.

#3 in reply to: ↑ 2 @Viper007Bond
7 years ago

Replying to mrmist:

The only issue that I can see with it is that it shows the content on comments that are awaiting approval to people who aren't comment moderators.

No it doesn't.

$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT $number");

#4 @mrmist
7 years ago

  • Milestone changed from 2.8 to 2.7
  • Version set to 2.7

If that query is being used then something is wrong somewhere. See attached screeny.

Clearly shows awaiting mod comments.

7 years ago

#5 @Viper007Bond
7 years ago

We're talking about different things. I'm talking about the sidebar widget, you're talking about the dashboard widget. I assumed the original reporter was talking about the sidebar one, but now I'm not sure.

Regardless, comments in moderation showing up is a separate issue. I've opened a new ticket and attached a patch: #8175

Still recommend wontfix for this ticket. Having comments on an unpublished post is very rare and addressing it would introduce extra queries.

#6 @mrmist
7 years ago

  • Severity changed from major to normal

Quick right. Sidebar widget is completely different. I wasn't reading the ticket properly.

Not sure about this one. It is messy to have comments showing up on unpublished posts, but I think the circumstances around which such a thing appears must be pretty rare, as Viper says.

#7 @ryan
7 years ago

  • Milestone 2.7 deleted
  • Resolution set to wontfix
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.