bbpc_validate_topic_recaptcha

The reCaptcha for bbPress 2.0 bbpc validate topic recaptcha function.

Description

bbpc_validate_topic_recaptcha( $reply_id ); 

Parameters (1)

0. $reply_id
The reply id.

Usage

  1. if ( !function_exists( 'bbpc_validate_topic_recaptcha' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'recaptcha-for-bbpress-2-0/bbpress-recaptcha.php'; 
  3.  
  4. // The reply id. 
  5. $reply_id = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = bbpc_validate_topic_recaptcha($reply_id); 
  9.  

Defined (1)

The function is defined in the following location(s).

/bbpress-recaptcha.php  
  1. function bbpc_validate_topic_recaptcha( $reply_id ) { 
  2. if( ! current_user_can('manage_options') ) {  
  3.  
  4. $bbpc_options = get_option('bbpc_settings'); 
  5.  
  6. if( is_user_logged_in() && !isset( $bbpc_options['show_to_logged_in'] ) ) 
  7. return; 
  8.  
  9. $privatekey = trim( $bbpc_options['private_key'] ); 
  10. $privatekey,  
  11. $_SERVER["REMOTE_ADDR"],  
  12. $_POST["recaptcha_challenge_field"],  
  13. $_POST["recaptcha_response_field"] 
  14. ); 
  15.  
  16. if ( ! $resp->is_valid ) { 
  17. bbp_add_error( 'bbp_reply_duplicate', __( '<strong>ERROR</strong>: The words you entered were incorrect', 'bbpress' ) );