Tips and Tricks HQ Support Portal › Forums › WP Affiliate Platform › Track new user account creation via paid membership pro
Tagged: contact 7, Free membership, paid membership pro
- This topic has 10 replies, 3 voices, and was last updated 10 years, 5 months ago by
admin.
-
AuthorPosts
-
December 11, 2013 at 12:08 am #10209
Nudeweb
MemberI am using Paid membership pro and currently have all levels set to free. I am suing the sweet date WP theme. I also have the following in functions.php to automatically assign new users to the promotional offer of top level membership (at the moment it’s free).
/* assign all new users to chosen member automatically */
add_action(‘user_register’, ‘kleo_pmpro_default_level’);
function kleo_pmpro_default_level($user_id) {
pmpro_changeMembershipLevel(4,$user_id);
}
I want to be able to pay affiliates for these membership signups, even though they are free. At the moment these are not being tracked as a sales conversion, only the referrals are being tracked. How can I track the free sign ups? Or perhaps just track new WP users?
Is there a function I can add that hooks on the sign up that will trigger a conversion for commission payment?
December 11, 2013 at 9:43 pm #59566admin
KeymasterMy recommendation would be to capture those signups as lead and then you can award commission later manually by going to the leads menu. Here is the documentation on how you can capture users as leads:
I recommend capturing them as leads first because that way you are not giving out commission for FREE signups without any kind of manual checks. It is bound to be abused by users when you directly give commission for free signups without some manual checks in the middle.
With that said, if you do want to give commission for those signups then take a look at the following documentation:
http://www.tipsandtricks-hq.com/wordpress-affiliate/api-awarding-commission-via-wordpress-hook-501
December 12, 2013 at 9:37 pm #59567Nudeweb
MemberHi, Thanks for the reply. I have tried the following in functions.php but it still does not register the signup.
add_action(‘user_register’, ‘mo_affilliate_signup’);
function mo_affilliate_signup() {
global $members_template;
$sale_amt = “19.95”; //TODO – The commission will be calculated based on this amount
$unique_transaction_id = “FREE-Signup”; //TODO – The unique transaction ID for reference
$email = $members_template->member->user_email; //TODO – Customer email for record
$referrer = $_COOKIE;
do_action(‘wp_affiliate_process_cart_commission’, array(“referrer” => $referrer, “sale_amt” =>$sale_amt, “txn_id”=>$unique_transaction_id, “buyer_email”=>$email));
}
The sale amount is irrelevant for me as it’s a fixed sign up commission of $1, unless if necessary I’m not bothered about a unique transaction_id as there is no real transaction.
Could you tell me what I’m doing wrong please.
December 12, 2013 at 11:54 pm #59568admin
KeymasterDid you make sure that the “mo_affilliate_signup” function is actually getting executed?
Also, you can enable debug in the affiliate plugin then check the log file which will tell you if the affiliate plugin is receiving this notification or not.
Regarding the sale amount, set it to a value that will turn out to be $1 commission (based on whatever commission rate you have set on your site).
You can handle the transaction ID like the following (it will generate a unique ID for each execution):
$unique_transaction_id = uniqid();
December 20, 2013 at 3:47 pm #59569Nudeweb
MemberI have amended the function as follows but it breaks the site
add_action(‘user_register’, ‘mo_affilliate_signup’);
function mo_affilliate_signup() {
global $members_template;
$sale_amt = “19.95”; //TODO – The commission will be calculated based on this amount
$unique_transaction_id = uniqid(); //TODO – The unique transaction ID for reference
$email = $members_template->member->user_email; //TODO – Customer email for record
$referrer = $_COOKIE;
do_action(‘wp_affiliate_process_cart_commission’, array(“referrer” => $referrer, “sale_amt” =>$sale_amt, “txn_id”=>$unique_transaction_id, “buyer_email”=>$email));
}
Could you tell me what I’m doing wrong please?
December 20, 2013 at 3:55 pm #59570Nudeweb
MemberOK found why the site was breaking I had the function in twice in functions.php
But could you tell me how to check to see if the function is being executed?
December 20, 2013 at 3:58 pm #59571Nudeweb
MemberSeems to be working!, Sorry for the convoluted thread.
April 3, 2014 at 12:58 am #59572xlspecial
MemberAfter searching for this solution for days I’m happy to have found this. My setup is pretty much the same as Nudewebs; Same theme and payment plugin and the above code is working except for some reason it does not pass the email. Meaning it does not show the user’s email in the backend in WP affiliate admin. Any ideas on this?
If there is some way to pass the $userid to the WP affiliate admin section? That would be great as it is easier to search members with their username ($userid) than it is email.
Thanks!
April 3, 2014 at 3:39 am #59573admin
KeymasterDo a test echo statement in your code to make sure that the following actually has an eamil address value in it:
$members_template->member->user_email;
You don’t have to pass the email address. Instead you could pass the userid via the email parameter. As long as you know that the field labeled “Email” is actually the user’s userid, there will be no issue.
April 3, 2014 at 9:11 am #59574xlspecial
MemberI tried putting $userid in place of $email bit that didn’t produce anything either.
I’m not a programmer, so not sure if I need to do more than that.
Thanks.
April 4, 2014 at 2:56 am #59575admin
KeymasterI am actually not familiar with that other plugin so I don’t know what exact value to use. If you need a custom job done then fill in the following form and we can take a look at it:
-
AuthorPosts
- You must be logged in to reply to this topic.