Hi, I'm writing an integration plugin to my affiliate program software. What I need to do for it to function properly, is to be able to track the affiliate that referred the new user to the system, so that whenever a new payment is issued the plugin will add the commission to the right affiliate. Before you ask... affiliate features existing in amember aren't enough, I need to use my affiliate software. The solution I have found at the moment, is to add a custom field to members and write there the id of the referring affiliate. And here comes the problem: the only way I found to fill that value is by making that field "displayed and editable" and using the fill_in_signup_form hook to give it the right value for the affiliate. That's not good at all because it will confuse the customer with a field he should leave as it is, and even worst, the customer may fill it with a value, that won't be correct. If I don't let the field to be displayed, even if it's assigned a value in the fill_in_signup_form hook, it won't be saved on the db. Another solution would be to make the field of type "hidden" instead of text, select etc... but that option is not available. Finally, the best solution would be for me to be able to give that custom field a value right after the new member has created the account, but it seems all the other hooks in the plugin will be executed only after the user activated the subscription by paying! (Which can't work for me, because at that point I may not be able to access the cookie storing the affiliate information). So, my question is: are there any hooks being called right after the user has been created, even if he has not yet paid? Also, if you know of any different solution to be able to track down the value I'm interested in, let me know. Thank you
Just found out that the update_payments hook will be called as soon as the user and order are created so it will work for my needs. Any further hint will be nonetheless appreciated
Open up the aMember file called signup.php and add this code before the line /* No unsubscribe new members! ///mod to add to yourplugin when user still pending yourplugin_pending($member_id,1,$db->get_user($member_id)); David
Thank you for the information If I apply that mod and later upgrade amember, I will have to apply it again, right? Using the update_payments hook I'm currently using may be a problem? Thank you again