Ticket #4108 (closed defect: fixed)

Opened 2 years ago

Last modified 2 years ago

comments awaiting moderation sometimes not displayed

Reported by: wnorris Assigned to: rob1n
Priority: normal Milestone: 2.2
Component: General Version: 2.1.3
Severity: normal Keywords: has-patch tested commit
Cc:

Description

comments awaiting moderation are displayed in the list of comments only for the person that posted the comment along with some text stating that it is awaiting moderation. The problem is the logic used to determine if the current visitor is the author of the comment... the only check is that the name and email address cookies coming from the browser match those on the comment. Users that are logged in, but do not have the name and email cookies set will be unable to view their unmoderated comments.

The attached patch will allow logged in users view their comments awaiting moderation. There is a TODO in the code to use the API instead of raw selects... perhaps that does need to be done at some point, but this at least addresses the short term.

Attachments

comment-template.diff (0.8 kB) - added by wnorris on 04/07/07 03:03:38.
initial patch

Change History

04/07/07 03:03:38 changed by wnorris

  • attachment comment-template.diff added.

initial patch

04/07/07 04:56:06 changed by foolswisdom

  • keywords set to has-patch.
  • milestone changed from 2.4 to 2.3.

(follow-up: ↓ 3 ) 04/07/07 05:00:04 changed by foolswisdom

wnorris, it seems that empty($comment_author) should by the if, and your new code the else if because empty should be the most likely condition.

(in reply to: ↑ 2 ) 04/07/07 06:22:44 changed by wnorris

Replying to foolswisdom:

wnorris, it seems that empty($comment_author) should by the if, and your new code the else if because empty should be the most likely condition.

actually that won't work, at least for the use case I have that led me to find this -- my openid plugin. Imagine I make a comment with my OpenID and it goes into the moderation queue. Because I authenticated with OpenID and very likely did not provide a name or email in the comment form, I would be displayed the already approved posts and be sent on my way, which is exactly what is happening now. First it needs to check if I'm logged in... if so, then it should display my comments still awaiting moderation regardless of what cookies I may have on my machine... I've already authenticated and that should trump everything else.

04/07/07 14:54:56 changed by foolswisdom

Very good point. I guess I subscribe to the school of do what is most likely put first. Based on what you wrote, then the first condition should still be empty($comment_author) but be changed to empty($comment_author) && !$user_ID. I don't think that is over optimization b/c currently ~90% of visiters don't comment (or have a login), maybe that will change with the adoption of OpenID (but not soon).

04/08/07 16:10:32 changed by foolswisdom

  • keywords changed from has-patch to has-patch tested.
  • milestone changed from 2.3 to 2.2.

Never mind my previous comment, the sql queries run are ~ the same O.

04/10/07 05:34:57 changed by wnorris

This still doesn't address one edge case, and I'm not sure that there's an easy way to do so... if you don't have "require name and email" enabled, and the user is not logged in, wordpress currently has absolutely nothing to track the user by. One possible solution would be a simple tracking cookie that is independent of the comment field data, but I'm sure that would come with some controversy, and justifiably so.

04/10/07 23:43:29 changed by rob1n

  • keywords changed from has-patch tested to has-patch tested commit.
  • owner changed from anonymous to rob1n.

I don't think that edge case is worth fixing. Anonymous posting is by definition not linked to anything.

04/11/07 03:12:13 changed by rob1n

  • status changed from new to closed.
  • resolution set to fixed.

(In [5238]) Tweak displaying comments awaiting moderation to their authors. Props wnorris. fixes #4108