Secure Login


Adding Captcha to bbpress

Adding Flexible Captcha to bbPress forms is quite easy since bbPress offers plenty of action hooks. Just add the following code to your themes functions.php file and your bbpress forum will be protected from spam.

add_action( 'bbp_post_request', 'fc_bbpress_check_captcha', 1);
function fc_bbpress_check_captcha() {
	global $FlexibleCaptcha;
	if (!$FlexibleCaptcha->check_captcha_val()) {
		bbp_add_error( 'fc_captcha', __( 'ERROR: The text you entered did not match the captcha image.', 'bbpress' ) );

add_action('bbp_theme_before_topic_form_submit_wrapper', 'fc_bbpress_add_fields');
add_action('bbp_theme_before_reply_form_submit_wrapper', 'fc_bbpress_add_fields');
function fc_bbpress_add_fields() {
	global $FlexibleCaptcha;
	print $FlexibleCaptcha->get_captcha_fields_display(get_option('FC_default_width'), get_option('FC_default_height'));

Be Sociable, Share!

You must be logged in to post a comment.