Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter masadri

    (@masadri)

    I’ve found out its problem after 3 or 4 days by reviewing recaptcha module from its plugin folder. Its error caused by wp_remote_post timeout so I added a filter for increasing its timeout and it is working great.

    hope help anyone who encounter this problem.

    here is filter:

    add_filter( 'http_request_timeout', 'wp_post_timeout_extend' );
    
    function wp_post_timeout_extend( $time )
    {
        // Default timeout is 5
        return 600;
    }

    or you can add timeout arg to wp_remote_post in [theme-my-login-folder]/modules/recaptcha/recaptcha.php :

    ....
    ....
    ....
    public function recaptcha_validate( $response, $remote_ip = '' ) {
    
    		if ( empty( $remote_ip ) )
    			$remote_ip = $_SERVER['REMOTE_ADDR'];
    
    		$response = wp_remote_post( 'https://www.google.com/recaptcha/api/siteverify', array(
    /*****THIS PART*****/	'timeout' => 600,		
    			'body' => array(
    				'secret'   => $this->get_option( 'private_key' ),
    				'response' => $response,
    				'remoteip' => $remote_ip
    			)
    		) );
    ....
    ....
    ....
    • This reply was modified 9 years, 1 month ago by masadri.
    • This reply was modified 9 years, 1 month ago by masadri.
    • This reply was modified 9 years, 1 month ago by masadri.
    Thread Starter masadri

    (@masadri)

    I’m sorry for my mistake its error is: “Unable to reach the reCAPTCHA server.”

    I’ve looked at the recaptcha.php and found out that error code is “recaptcha-not-reachable”

    • This reply was modified 9 years, 1 month ago by masadri.
Viewing 2 replies - 1 through 2 (of 2 total)