Association Not Working #2

This is a follow-up to : https://www.itthinx.com/topic/association-not-working/

Hey George,

Thank you for the suggestion, however I’m really not sure how I would go about achieving this.

What do you mean by initiating ajax only on failed logins?

That’s not an option provided by WLL.

Why does changing the ajax init prevent Affiliates Permanent from making the association? Would it be possible instead to force Affiliates to make the association regardless of how ajax was initiated?

Regards,
B


Comments

6 responses to “Association Not Working #2”

  1. That’s fantastic George!

    Way to start the day 😉

    A thousand times thank you for your help with this. Things are about to get really interesting from here!

    Kind regards,
    B

  2. Hi Bastien,

    The referring affiliate is working now. It seemed that is_admin() was conflicting with social login.
    It works normally now, so you can safely disable debugging.

    Cheers

    Cheers

  3. Hey George,

    I saw you added some plugins to view the debug log. While debug was ON, debug_log was off so I activated that too and data started to come in. I also enabled ajax log, so there’s also the file “__wpe_admin_ajax.log” now to provide useful information related to ajax calls.

    I wasn’t able to findf the “affiliate id” string you set to be written in the log in “Affiliates Set New User Referrer”. However I did find in the admin ajax log a reference to “[wp_affiliates] => 2” so the data seems to be available at some point. Unfortunately the association is still failing when registering through social networks.

    I’ll wait for your feedback.

    Kind regards,
    Bastien

  4. Hi Bastien,

    Thanks for sharing the conversation, i will have a look on login with social networks and let you know.

    Kind regards,
    George

  5. Hello George,

    Here’s the reply I got from the RightHere developers :

    Hi,

    Our fix moves the login ajax to admin-ajax.php wich is in the admin.

    The affiliate plugin has an option ‘affiliates_user_registration_on_admin’ in the code. If this option is turned on the affiliate will be associated.

    We could not find this option. however it is in the code in the file lib/core/class-affiliates-user-registration.php

    We will add a small plugin that forces this option ON.

    Will get back to you shortly.

    Regards,
    Alberto Lau.

    —-

    Hi,

    Unfortunately that didnt work. it seems that the affiliate system will not associate the affiliate if the procedure is ran in the admin.

    We will try to find an alternative.

    Regards,
    Alberto Lau.

    —-

    Hi,

    We uploaded a small file to wp-admin/spl.php and pointed the ajax to that file.

    The error messages are showing and the affiliate is being recorded as expected.

    Best regards,
    Alberto Lau.

    I then made some tests and noticed that while it fixed the assignment for manual registration, new users created through social login weren’t assigned…

    Hey Alberto,

    Thank you for the workaround. Manual registration now works indeed and the referring affiliate is now assigned to the new user!

    However if we use one of the social logins to create a new account, the user is still not assigned to the referring affiliate.

    Could it be possibly easily fixed with the code you added?

    Thank you infinitely for your help.

    Kind regards,
    B

    Here’s the reply they gave me :

    Hi,

    If the Affiliate plugin developers provide a procedure we can implement it.

    When login with social network, the action user_register is called, however it doesnt seems that the affiliate plugin is completing the process on this case.

    Regards,
    Alberto Lau.

    Waiting for your feedback.

    Kind regards,
    B

  6. Hi Bastien,

    Sorry i didn’t express it pretty clearly in my previous comment.

    You can disable ajax from WLL and since you need it only for false logins, you can enable it when wp_authenticate fails.
    i.e.
    add_action( 'wp_authenticate' , 'failed_authentication' );

    function failed_authentication ( $username ) {
    if ( ! username_exists( $username ) ) {
    //initialize ajax here
    }
    }

    Kind regards,
    George

Share