Tagged: bp-ajax-registration
Hi John,
I am sorry but there is no way to post that data from the header form to the ajax registration form.Hi Brajesh.
Ok, no worries, I will have to work around this. Please help with another issue: When a new user registers and misses out a required field, the form doesnt reload, so the error message “user name requires 4 digits” (for example) remains and the captcha code dissapears. Any ideas please?
John.Hi John,
I am sorry I missed the post due to site upgrades going on here.Can you please tell me which captcha plugin are you using? We may need to trigger some function to reload the captcha.
I will do a quick check and provide a solution after you let me know the plugin.
PS: The form actually reloads but may not look like that. When ever you press submit button, the form is always reloaded. The UI may not reflect that if your server is fast.
Hi Brajesh.
Thank you for the reply.The Captcha plug in is “buddypress captcha from this plugin site: https://wordpress.org/plugins/buddypress-captcha/
The php code is here:
<?php
/*
Plugin Name: BuddyPress Captcha
Plugin URI: http://www.trickspanda.com
Description: This plugin adds a reCAPTCHA form to BuddyPress registration form to keep your community spam free.
Version: 1.1
Author: Hardeep Asrani
Author URI: http://www.hardeepasrani.com
Requires at least: WordPress 2.8, BuddyPress 1.2.9
License: GPL2
*//* Options */
$public_key = get_option(‘bpcapt_public’);
$private_key = get_option(‘bpcapt_private’);
$theme = get_option(‘bpcapt_theme’);
$lang = get_option(‘bpcapt_language’);
$strError = __(‘Please check the CAPTCHA code. It\’s not correct.’, ‘buddypress-recaptcha’);require_once(‘recaptcha-php-1.11/recaptchalib.php’);
require_once(‘bpcapt-options.php’);function bp_add_code() {
global $bp, $theme, $lang, $public_key;$script = “<script type=\”text/javascript\”>
var RecaptchaOptions = {
theme : ‘”.$theme.”‘,
lang: ‘”.$lang.”‘
};
</script>”;$html = ‘<div class=”register-section” id=”security-section”>’;
$html .= ‘<div class=”editfield”>’;
$html .= $script;
$html .= ‘<label>CAPTCHA code</label>’;
if (!empty($bp->signup->errors[‘recaptcha_response_field’])) {
$html .= ‘<div class=”error”>’;
$html .= $bp->signup->errors[‘recaptcha_response_field’];
$html .= ‘</div>’;
}
$html .= recaptcha_get_html($public_key);
$html .= ‘</div>’;
$html .= ‘</div>’;
echo $html;
}function bp_validate($errors) {
global $bp, $strError, $private_key;if (function_exists(‘recaptcha_check_answer’)) {
$response = recaptcha_check_answer($private_key, $_SERVER[‘REMOTE_ADDR’], $_POST[‘recaptcha_challenge_field’], $_POST[‘recaptcha_response_field’]);if (!$response->is_valid) {
$bp->signup->errors[‘recaptcha_response_field’] = $strError;
}
}return;
}add_action( ‘bp_before_registration_submit_buttons’, ‘bp_add_code’ );
add_action( ‘bp_signup_validate’, ‘bp_validate’ );?>
Thank you John.
Will be testing and getting back to you in next couple of hours.Thank you Brajesh.
If you need anything else, please let me know.
Hi John,
Just a small update.
That plugin was using Recaptcha old libray and I had to update it. It is working for now. I will need till tomorrow to finish the plugin( Needs some cleanup as I did a lot of breaking here & there ). Have notified the author on wp.org about it and if he provides a way, will send him the updated file too.Please bear with me till tomorrow.
Thank you
BrajeshJust received a response from Hardeep, so I guess you won’t have to update manually. An update will be available from wp.org by tomorrow.
Thank you Brajesh for your diligence and perseverance to get this right for me and others who use this plugin.
Really appreciated. I await the update.
John.
You must be logged in to reply to this topic.