• Hey there,

    Very cool plugin. I just need to report an issue that it has…which can be easily fixed. I’ve got code fixes for you too. ??

    Right now the Agreeable plugin, if used with a registration anti-spam plugin, can completely disable the other plugin. The reason this happens is that in your registration_validation() function, you are creating a brand new WP_Error object. The thing is, WordPress already created one specifically for registrations, which is passed to functions that use the registration_errors hook. So if any anti-spam plugins fire before yours, their errors are lost, and therefore bypassed by spammers. (If they hook with a priority after your plugin, they will be fine….but that ends up being hit or miss.)

    Please see the WordPress Codex entry for the registration_errors filter hook for more info. https://codex.www.ads-software.com/Plugin_API/Filter_Reference/registration_errors

    It’s an easy fix though. In the agreeable.php file, on line 37 change this:

    add_filter('registration_errors', array($this, 'registration_validation'), 0, 2);

    to this:

    add_filter('registration_errors', array($this, 'registration_validation'), 0);

    Then on line 136, change this:

    function registration_validation() {

    to this:

    function registration_validation( $errors ) {

    That will allow you to simply add your errors in with any existing ones already in the object.

    Then delete this on line 138 since it’s not needed:

    $errors = new WP_error();

    Now your plugin will be a first class team player. ??

    Please fix as soon as you can…thank you!

    – Scott

    https://www.ads-software.com/plugins/agreeable/

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Disables registration anti-spam – registration_validation() error, with a fix’ is closed to new replies.