Automattic / Automattic/jetpack

Carousel: Add pre_comment_on_post hook.

Open
#7,731 2 comments 0 reactions 0 assignees View on GitHub
[Feature] Carousel Enhancement
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

I'm using the Jetpack Carousel and a [captcha plugin](https://wordpress.org/plugins/google-captcha/), which is set to require captcha completion before allowing comments from unauthenticated users. The captcha plugin appears to use the [pre_comment_on_post](https://developer.wordpress.org/reference/hooks/pre_comment_on_post/) WordPress hook to verify the captcha on the server side. However, the [post_attachment_comment function in Jetpack Carousel](https://github.com/Automattic/jetpack/blob/c36fea768e34487d77fc6dab77515284ced32eab/modules/carousel/jetpack-carousel.php#L527) appears to call `wp_new_comment` to create a comment, without first calling `pre_comment_on_post`.

I've verified that the Jetpack Carousel bypasses the captcha requirement on my blog, but I'm not 100% sure the fault is in Jetpack as opposed to a third party. Apologies if I misunderstood the code.

Contributor guide

Open the contributing guide

Research direction

Start in modules/carousel/jetpack-carousel.php at the post_attachment_comment function and compare its wp_new_comment flow with WordPress's pre_comment_on_post hook. Verify how the captcha plugin uses that hook and check any existing Carousel comment tests. Done means unauthenticated Carousel comments trigger the same server-side validation as regular comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, wordpress
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.