Opened 4 years ago
Closed 8 months ago
#39274 closed feature request (wontfix)
Consider a capability for posting comments
Reported by: | johnjamesjacoby | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | 2nd-opinion |
Focuses: | Cc: |
Description
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)
Note: See
TracTickets for help on using
tickets.
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 theexist
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.