• Resolved rexreed

    (@rexreed)


    Hello —

    I use WP-Members plugin and I know that Ban Hammer doesn’t on its own support integration with WP-Members. I know I can use the advanced integration method by creating an integration with a hook, but I can’t figure out the method to integrate it with WP_Members, which I think uses is_email()

    I also use Contact Forms 7, which I think also uses the is_email function.

    Does anyone have any tips on how to integrate Ban Hammer with WP-Members and Contact Form 7 specifically? Any code examples that I could create a snippet with? The plugin looks promising, but obviously want to use it besides the default WordPress registration interface.

    Any pointers on how to integrate with the above two common plugins?
    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    is_email() just checks if email is valid or not. You would have to find the function they use to validate registration. So WooCommerce has woocommerce_registration_errors and that means you’d probably want this: https://rocketgeek.com/plugins/wp-members/docs/filter-hooks/wpmem_pre_validate_form/

    The pre-hook would be “Before you check if WP Members can register someone, check if BanHammer okays it.”

    Thread Starter rexreed

    (@rexreed)

    Thanks – I’m looking into the WP Members wpmem_pre_validate_form hook as we speak.

    Just out of curiosity, why would hooking into is_email() not be the better approach? In this way I can just reject the emails as invalid even before the reg check. And then it could be used for other forms (Such as Contact Form 7) that also use is_email?

    I’m looking for documentation on how to hook into is_email as well – the WP docs site doesn’t show how to hook into that.

    Thread Starter rexreed

    (@rexreed)

    Also, just another question, if we’re calling banhammer_drop on an email, why do we need a USERNAME as suggested here:

    (new BanHammer)->banhammer_drop( USERNAME, EMAIL, ERRORS )

    Can’t I just pass the email and no username?

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    Just out of curiosity, why would hooking into is_email() not be the better approach?

    Because it’s very broad. I don’t know if other things would break by using that.

    Passing the username is because we’re a pause in the filter, not the final stop. If you have other plugins with other filters, we don’t want to goober them up ??

    Also in the case of WooCommerce, not passing the username made it stop working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Best way to hook into is_email() function’ is closed to new replies.