Skip to:
Content
Pages
Categories
Search
Top
Bottom

fyi: WP-reCAPTCHA works fine with BuddyPress

Viewing 25 replies - 26 through 50 (of 51 total)
  • @r-a-y

    Keymaster

    There are no instructions I’m afraid. You have to dive into the BuddyPress code.

    Just looked at the plugin, here’s some sample code:

    add_action('bp_before_registration_submit_buttons', 'display_recaptcha', 9999);
    add_action('bp_signup_validate', 'check_recaptcha_bp');

    You’ll have to write your own validation function for BP. I’ve called the new function check_recaptcha_bp(), but you can call it whatever.

    For more info, look at buddypress/bp-core-signup.php, I’ve given you the tools needed to walk, now run with it ;)

    @peterkirn

    Participant

    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/

    You active bpdev-core and then bpdev-nospam.

    @peterkirn

    Participant

    Sorry, I realize I read that last post incorrectly.

    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’);

    — and it looks like the same code you’d need for BP:
    http://pastebin.com/MX0LHmtE

    Am I missing something? Is there something else BP needs? It appears to me that the bp_signup_validate action lacks documentation.

    @peterkirn

    Participant

    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?

    So obviously more work to do. But it’s at least part way there.

    @r-a-y

    Keymaster

    Hey Peter, didn’t see your post until just now.

    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.

    FYI, I’m not using WP-reCAPTCHA.

    Might I suggest using a math challenge plugin? It’s more user-friendly than a captcha plugin.
    https://wordpress.org/extend/plugins/wpmu-block-spam-by-math/

    [EDIT]
    Here’s another captcha plugin that supports BP:
    https://wordpress.org/extend/plugins/super-capcha/

    @peterkirn

    Participant

    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!)

    Here’s my display code:
    http://pastebin.com/QcMXCTGz

    Here’s how I’m recording errors (which is in fact working):
    if (empty($_POST) || $_POST == ”) {
    $bp->signup->errors = __( ‘Please fill in the reCAPTCHA form.’, ‘buddypress’);
    }

    And for context, the whole plug-in, though most of it’s the old wp-recaptcha code (I’ll clean this up and put it on GitHub shortly)
    http://pastebin.com/urNP96Nz

    @peterkirn

    Participant

    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)

    @r-a-y

    Keymaster

    Forgot to mention that you’re missing a do_action in your display_recaptcha_bp() function.

    Based on the code you’re using, that code is:
    do_action( 'bp_captcha_errors' );

    You should also remove the WPMU check since BP works on standard WP circa v1.2.

    I’ve amended your code here:
    http://pastebin.com/QCbxXvhh (untested)

    Also, Peter, did you ask the original author of the plugin for permission before attempting to fork it? It’s just a courtesy thing.

    If I did what you did, I could have released a thousand plugins by now! Okay maybe not a thousand but you get my point!

    @peterkirn

    Participant

    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.

    Peter

    @peterkirn

    Participant

    Just tested it; that code does indeed work. I did need to then add an error display function, of course; right now that looks like this:
    http://pastebin.com/v65A8mrk

    Some cleanup to do on CSS, but otherwise this is functioning! Thanks!

    I’ll keep you posted.

    @peterkirn

    Participant

    Full code…
    http://pastebin.com/mWUALgdD
    And again, apologies if I’m a bit slow on this stuff; as I said, part of why I wanted to tackle this.

    @peterkirn

    Participant

    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

    Keymaster

    I’m glad you asked the author and are contributing to the plugin!

    One thing WP-reCAPTCHA will probably need is to make the plugin BP-aware. More info here:
    https://codex.buddypress.org/how-to-guides/make-your-plugin-buddypress-aware-v1-2/

    This BP-aware code could then also be used as a conditional check.

    I’ll take a look at the code in the next couple of days. It is indeed a Friday evening ;)

    Btw, glad to hear you’ll be contributing to the codex in the future! BP is most definitely a fun script to pick up and learn!

    @peterkirn

    Participant

    @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.

    @hmeister

    Member

    Peter, thanks for providing a mod that hooks into BP!

    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…

    @stoi2m1

    Participant

    @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.

    Can you tell me what you did to fix it?

    @enrige

    Participant

    I also have the same problem with reCAPTCHA

    With wp 2.9.2 e bp 1.2.5.2 reCAPTCHA is not work !

    @thealchemist

    Member

    I have a completely different problem … CAPTCHA on comments appears fine. It is not appearing on the registration page: http://www.xbox-arena.com/register

    @dog0012

    Member

    The wp-reCAPTCHA plugin is marked as broken! Please fix asap

    @jconti

    Participant

    @satishkn

    Member

    Hi,

    Wangguard’s site is too slow. Also, the connection to the site keeps resetting even for login / getting the key and such. I seriously doubt if the plugin works smoothly after configuration.

    @ddean

    Participant

    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.

    http://www.jerseyconnect.net/development/download/bp-recaptcha.zip

    @noahy

    Member

    This code is working on my multi-site install:

    https://buddypress.org/community/groups/third-party-components-plugins/forum/topic/simple-recaptcha-for-buddypress-register-page/

    Hopefully I’m not missing anything…

    @jconti

    Participant

    Hi @satishkn

    WangGuard load on 0.07 seconds http://www.iwebtool.com/speed_test?domain=http%3A%2F%2Fwww.wangguard.com

    Do you really think wangguard is very slow?

    @archetoy

    Member

    This seems to be a nice plugin that works on buddypress:
    https://wordpress.org/extend/plugins/buddypress-recaptcha/

    Some slight manual additions (just add your recaptcha keys into the actual php file), but apart from that, clean, simple it seems.

Viewing 25 replies - 26 through 50 (of 51 total)
  • The topic ‘fyi: WP-reCAPTCHA works fine with BuddyPress’ is closed to new replies.
Skip to toolbar