• Hi Guys,

    Hopefully someone can help with a small issue I’m having as currently pulling my hair out!

    I’m trying to setup WP-Affiliate and get it to register affiliates when they purchase a subscription through an Authnet Pro form. However, despite setting the option within the Affiliate plugin users are not being registered as affiliates when they subscribe to the blog.

    I’ve tried adding a user to the blog through the Dashboard and that registers them as a affiliate fine. Just not when I use the pro form.

    Upon doing some checking I can see that the function that adds them as an affiliate is attached to the ‘user_register’ hook. However, this does not seem to get fired when I register through the pro-form. I’ve proved this by attaching a custom function to the hook which generates a log message. This only gets called when registering via the dashboard, not the pro-form.

    So, my question is two-fold. Firstly, is there a reason why the ‘user-register’ hook is not being called when using the pro-form? Secondly, this being the case is there another hook I can use to do the affiliate registration that will be called EVERY time a user registers on the site.

    Many Thanks.

    https://wordpress.org/plugins/s2member/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter bazchas

    (@bazchas)

    Hey guys,

    Sorry to bounce but is there any chance of an update on this. It’s fairly time critical as we’re pushing towards the site launch and this is a bit of a show stopper.

    Any assistance would be very much appreciated.

    Best wishes.

    I asked Jason about it and this was his reply:

    ” I would suggest that they use one of s2Member’s API Notifications for this. They are the perfect tool for the job there. WP Admin -> s2Member -> API / Notifications

    “Otherwise, if a particular plugin (i.e. WP Affiliate) is not working properly with s2Member’s hooks; or not with certain hooks fired by s2Member; that’s something they would want to contact WP Affiliate about.

    “If there is a technical issue identified, please have them create an issue for us at GitHub.” https://github.com/WebSharks/s2Member/issues

    Thread Starter bazchas

    (@bazchas)

    Hi Christian,

    Thanks very much for your response.

    I’ve been reading over the forum and can see as you say that I could probably achieve this by using custom code and some of the API functionality you mention.

    I’m happy to do this, or indeed raise an issue over on GitHub. However, before I do I just wanted to understand the reason why the ‘user_register’ hook isn’t being fired when a user registers from the ProForm. From reading the WP-Affiliate forum they have worked with you guys to integrate the two plugins and I have seen posts from Jason saying that the hook is fired from S2. I’ve also spotted it in your functions in the code, it just doesn’t seem to get fired when I need it!

    If this is working as intended then I’ll implement with my own code, just wanted to make sure before I start down that route.

    Many thanks in advance!

    Thread Starter bazchas

    (@bazchas)

    Hey Christian,

    Just a bit of further info. I’ve been doing a bit more testing and have discovered that the ‘wp_login’ hook doesn’t appear to get fired either for non admin logins.

    Again, I’ve attached a logging function to both the ‘wp_login’ and wp_logout’ hooks. With an admin user both hooks get fired as I would expect. However, with a non-admin user only the ‘wp-logout’ hook is fired.

    Is this by design or a potential issue?

    Again, I’ve identified a possible work around that I can use to implement the functionality I require. That said I’d just like to understand why these hooks aren’t being fired?

    Best wishes,

    Nigel.

    I asked Jason and this is what he said:

    “The user_register hook in WordPress is always fired during a Pro Form submission when there is a new customer. The only time it would not be fired is when/if the user is already logged into the site when they begin checkout (i.e. NOT a new user). s2Member calls upon wp_create_user() which calls upon wp_insert_user(), which fires user_register. s2Member does in fact handle the registration of a customer via the user_register hook. So if that were not firing for some reason (e.g. theme/plugin conflict of some sort), there would be a bigger problem to deal with all together. s2Member itself would be broken as well.”

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘User Registration Hooks not Firing’ is closed to new replies.