Title: Problem on Comments
Last modified: April 15, 2020

---

# Problem on Comments

 *  Resolved [pfsm999](https://wordpress.org/support/users/pfsm999/)
 * (@pfsm999)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/problem-on-comments-2/)
 * Hello,
 * I find some problem on your 1.3 plugin :
    on comment_form.php on default folder.
 * `add_action( 'comment_form', 'hcap_wp_comment_form' );`
 * Why ?
    comment_form will put your captcha AFTER the submit button … non sense.
   Change it for : `add_action( 'comment_form_after_fields', 'hcap_wp_comment_form');`
 * And in hcap_verify_comment_captcha
    Your forgot one important point : an admin
   cannot answser his comments on the administration side … because the captcha 
   is not showing on the administration.
 * I take the liberty to update this :
 *     ```
       function hcap_verify_comment_captcha($commentdata) {
   
       	if(!is_admin() || current_user_can('administrator')){
       		if (isset( $_POST['hcaptcha_comment_form_nonce'] ) && wp_verify_nonce( $_POST['hcaptcha_comment_form_nonce'], 'hcaptcha_comment_form' ) && isset($_POST['h-captcha-response'])) {
       			$get_hcaptcha_response = htmlspecialchars( sanitize_text_field( $_POST['h-captcha-response'] ) );
   
       			$hcaptcha_secret_key = get_option('hcaptcha_secret_key');
       			$response = wp_remote_get('https://hcaptcha.com/siteverify?secret=' . $hcaptcha_secret_key . '&response=' . $get_hcaptcha_response);
       			$response = json_decode($response["body"], true);
       			if (true == $response["success"]) {
       				return $commentdata;
       			} else {
       				wp_die( __( '<strong>ERROR</strong>: Invalid Captcha', 'hcaptcha_wp' ), __( '<strong>ERROR</strong>: Invalid Captcha', 'hcaptcha_wp' ), array('back_link' => true)  );
       			} 
       		} else {
       			wp_die( __( '<strong>ERROR</strong>: Invalid Captcha', 'hcaptcha_wp' ), __( '<strong>ERROR</strong>: Invalid Captcha', 'hcaptcha_wp' ), array('back_link' => true)  );
       		}
       	}
       	else{
       		return $commentdata;
       	}
       }
       ```
   
 * Please, update fast as possible your plugin !!
    Regards. Paul FLYE SAINTE MARIE
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fproblem-on-comments-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Author [hcaptcha](https://wordpress.org/support/users/hcaptcha/)
 * (@hcaptcha)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/problem-on-comments-2/#post-12675984)
 * Hi there, thanks for the report! This is actually a user-supported open source
   plugin: you can see the repo at [https://github.com/hCaptcha/hcaptcha-wordpress-plugin](https://github.com/hCaptcha/hcaptcha-wordpress-plugin)
 * We accept PRs there and release new versions regularly.
 *  Thread Starter [pfsm999](https://wordpress.org/support/users/pfsm999/)
 * (@pfsm999)
 * [6 years, 1 month ago](https://wordpress.org/support/topic/problem-on-comments-2/#post-12676006)
 * Hello 🙂
    It’s done and thanks for your quick reply !!!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Problem on Comments’ is closed to new replies.

 * ![](https://ps.w.org/hcaptcha-for-forms-and-more/assets/icon.svg?rev=3026321)
 * [hCaptcha for WP](https://wordpress.org/plugins/hcaptcha-for-forms-and-more/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/hcaptcha-for-forms-and-more/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/hcaptcha-for-forms-and-more/)
 * [Active Topics](https://wordpress.org/support/plugin/hcaptcha-for-forms-and-more/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/hcaptcha-for-forms-and-more/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/hcaptcha-for-forms-and-more/reviews/)

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)

 * 2 replies
 * 2 participants
 * Last reply from: [pfsm999](https://wordpress.org/support/users/pfsm999/)
 * Last activity: [6 years, 1 month ago](https://wordpress.org/support/topic/problem-on-comments-2/#post-12676006)
 * Status: resolved