Make WordPress Core

Opened 7 years ago

Closed 4 years ago

#39274 closed feature request (wontfix)

Consider a capability for posting comments

Reported by: johnjamesjacoby's profile johnjamesjacoby Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Comments Keywords: 2nd-opinion
Focuses: Cc:


The wp_handle_comment_submission() function currently includes a bunch of internal logic for concluding if a comment submission is possible given a number of criteria relative to:

  • The post the comment would belong to
  • Settings for the post
  • Site settings
  • Current user if logged in
  • Email address validation if logged out

While some of this logic is relatively complex, all of it together answers the question: can the current user (logged in or out) comment on the current post. As such, I think it would make sense to consider a dedicated mapped meta capability to identifying whether the current user has the ability to post a comment.

There may be some/many things that prevent this from being easily achievable, and I haven't dug too deeply into investigating what they might be exactly.

Change History (2)

#1 @johnbillion
7 years ago

The fundamental problem here is that current_user_can() should always return false for a non-logged-in user, although some plugins such as BuddyPress check the exist capability against non-logged-in users.

The logic in wp_handle_comment_submission() could be further abstracted into a separate function, but it doesn't make sense for it to be mapped to a capability.

#2 @andraganescu
4 years ago

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

Given there have been no other advances here and that @johnbillion 's comment is quite clear on the matter I will close this as wontfix.

Note: See TracTickets for help on using tickets.