• Resolved omerps

    (@omerps)


    I am allowing users to register on my website in a custom-made sign-up form. This sign-up form uses Ajax to create and sign up the users. I found that the plugin does not work with the Ajax sign-up.

    When I looked in the files, I saw the file lib/core/class-affiliates-users-registration.php. On line 78, there is an if statement checking is_admin() and then checks a filter called “affiliates_user_registration_on_admin”. If is_admin() is true and “affiliates_user_registration_on_admin” is not allowed, it returns.

    Since I could not find where to change the filter’s value, I tried to comment it, and then registering using my Ajax sign-up form worked and the Affiliates plugin counted the registration. But it counted it twice.

    So my question is, does the plugin allows Ajax registration?

    Thanks,
    Omer.

Viewing 1 replies (of 1 total)
  • Plugin Author itthinx

    (@itthinx)

    Hi,

    The filter affiliates_user_registration_on_admin can be used with your callback to return true when needed. This should be made conditional to make sure it only returns true when you recognize a valid form submission. If you get multiple referrals for the same submission, that would mean that in the process of the form submission, the user_register action is being triggered twice. This might be a bug in your form plugin and should be looked into separately as it is not caused by the Affiliates plugin. However, a workaround for that would be to count how many times your affiliates_user_registration_on_admin filter has been processed and only return true one time during the same request.

    Please note that you should avoid modifying the code of the Affiliates plugin itself, but use actions and filters instead as indicated above. If you are not familiar with how these work, you can learn how filters are used in the Filters section of the WordPress documentation.

Viewing 1 replies (of 1 total)
  • The topic ‘Ajax Registeration’ is closed to new replies.