Plugin Directory

Changeset 1064740


Ignore:
Timestamp:
01/10/2015 04:31:35 PM (11 years ago)
Author:
elrata_
Message:

Add callbacks for Buddypress and lostpassword form

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-recaptcha-bp/trunk/recaptcha.php

    r1064739 r1064740  
    6767            add_action('register_form', array(&$this,
    6868                'show_recaptcha_in_registration'));
    69         }
     69            add_action('bp_before_registration_submit_buttons', array(&$this,
     70                'show_recaptcha_in_registration'));
     71            add_action('bp_signup_validate', array(&$this,
     72                'check_recaptcha_generic'), 0);
     73        }
     74
     75        add_action('lostpassword_form', array(&$this,
     76                'show_recaptcha_in_registration'));
     77        add_action('lostpassword_post', array(&$this,
     78                'check_recaptcha_generic'), 0);
    7079
    7180        add_action('comment_form', array(&$this, 'show_recaptcha_in_comments'));
     
    328337        }
    329338        return $comment_data;
     339    }
     340
     341    function check_recaptcha_generic() {
     342        global $user_ID;
     343        if ($this->_reCaptchaLib == null) {
     344            $this->_reCaptchaLib = new ReCaptcha($this->options['secret']);
     345        }
     346        $response = $this->_reCaptchaLib->verifyResponse(
     347            $_SERVER['REMOTE_ADDR'],
     348            $_POST['g-recaptcha-response']);
     349
     350        if (!$response->success) {
     351            $this->_saved_error = $response->error;
     352            $error = __('Please check the CAPTCHA code. It\'s not correct.', 'g-recaptcha');
     353            wp_die("<strong>$error</strong>");
     354            return false;
     355        }
     356        return true;
    330357    }
    331358
Note: See TracChangeset for help on using the changeset viewer.