Hi r-a-y — would you be interested in posting your validation function code? (pastebin it perhaps?)

Just want to avoid reinventing the wheel. I also found a plugin in bpdev that appears to be doing this, as well, even down to adapting the existing WPMU recaptcha plugin, but it doesn’t seem to work / was never finished. I haven’t worked out just why yet, however. http://bp-dev.org/download/

I’ve dug into the code myself and have nearly everything working, but I’m unclear on the function for bp_signup_validate. In the WPMU plugin, there’s already validation checking for WPMU. Why not simply use:
add_action(‘bp_signup_validate’, ‘check_recaptcha_wpmu’);
?

For the WPMU code, this is called as a function:
add_filter(‘wpmu_validate_user_signup’, ‘check_recaptcha_wpmu’);

Okay, very nearly there. I now have registration working – unless you don’t enter the captcha correctly, in which case I get a page not found (curiously, still for /register) Any sense why this might happen when porting code from WPMU to BP?

You’re right that documentation is sparse, but that’s up to users like you and me to add it to the BuddyPress codex.

BuddyPress uses a different method to validate that’s why you can’t just hook in the WPMU validation function that WP-reCAPTCHA uses.

Like I stated above, look for clues in /buddypress/bp-core-signup.php. Check out the global $bp variable, especially $bp->signup->errors. This is what you have to use in place of what the check_recaptcha_wpmu() function uses.

Here we go, here’s the issue: I understand how to hook in now, and I’m correctly writing errors to $bp->signup->errors. I’m just unclear on how to accurately display those errors for the ‘captcha’ field. Right now, my signup is validating properly and even recording the correct errors; I just can’t display the errors on the actual form. (Doh!)

PS, I think now based on your other posts I can help with that wiki documentation; it’d be my pleasure — I just have to understand what I’m doing *before* I document it, not the other way around. (and then happy to have you tech edit it to see if I’ve gotten it right)

Hi Ray,
Thanks for that help! That’s great; now much clearer to me. Huge help!

I did email the author. I haven’t heard back yet. I’m not intending to release a fork without permission.

In fact, on the contrary, my main goal here is just to learn a bit about BP development before we move on, and to make sure there’s some kind of solution – even as a stopgap – to allow switching on BP blogs without a torrent of spam. That’s made our registration system effectively unusable. I was unaware of some of the other options, but to be perfectly frank, I think it’s unacceptable that there isn’t at least some option in core. (It’s the situation that had been Akismet in the 1.x days of WP.)

But that, and since you’ve posted a lot of good info in the forum, happy to go through it and through the eyes of someone to whom this is new, try to format it in a way that could be friendlier to developers.

I’m in absolute agreement that releasing a zillion forks is not a good idea. I’ll keep testing here and document my experience but will refrain from releasing anything until I hear back from the author.

I think that’d be the next question, whether this conditional code gets rolled into the main wp-recaptcha plug-in. In that case you’d leave the WPMU and “legacy” WP checks so you’d have one recaptcha plug-in to rule them all, which is probably best.

Scratch that — spoke to Blaenk, and I’ll just contribute to his project. So R-a-y, if you have any more thoughts for improvements looking at that, let me know, as I’ll try to clean this all up this weekend and make it less of a hack.

The beauty of Friday evening (and maybe Mercury is no longer in retrograde), everything’s coming together.

@r-a-y: Excellent. Let me refactor the code accordingly, as I think we’re in agreement that the ultimate goal is to do one wp-recaptcha that works everywhere. I need to actually go off the new 3.0 codebase from Blaenk, anyway; won’t be hard to do that. Once I have a new version up, I’ll have it in Git; that way, other BP users can look at it and try it out before there’s an official release bringing wp-recaptcha and the temporary bp version back together later this summer.

I know this probably doesn’t have anything to do with the plugin itself, but is your captcha getting verified properly? I’m getting that the response was incorrect even though it was entered correctly. Other than a small logic error in the check_recaptcha_bp() function, the plugin seems to be fine. It’s checking for an empty response, but then continues on even if it was empty, to check if the response was correct. I guess you could either have an else case or just return when the response is empty.

I even tried with the latest recaptcha library (v1.11), but still getting the same problem. My API keys checks out. Very strange…

@d-a-n My captcha never verifies and gets the same error no matter the condition of the captcha response field. If its empty, wrong or correct I get the error ‘That reCAPTCHA response was incorrect’. Ive tried changing the logic around and the only other outcome is the captcha is always true.

BuddyPress’s registration page and process don’t use the hooks WP-reCAPTCHA is expecting.

Here’s a small (~40 lines) plugin to make the reCAPTCHA field show up and be processed during registration. This has only been tested on single-site installs, and probably won’t work (or will mess up) a multi-site install, because that will trigger different behavior from WP-reCAPTCHA.