Tips and Tricks HQ Support Portal › Forums › WP eStore Forum › Affiliate ID/field included in registration page to manually set the affiliate
Tagged: affiliate code, WP Affiliate
- This topic has 18 replies, 4 voices, and was last updated 8 years, 6 months ago by
woodybongard.
-
AuthorPosts
-
December 27, 2013 at 6:30 am #10297
rchan454
MemberI am using eStore, eMember, and WP Affiliate and was wondering if there is any way to add a field during the registration process for customers to optionally add an affiliate ID. This should be able to verify if the affiliate ID exists and give credit to that affiliate automatically. I have added a custom field but that does not connect to the affiliate plug-in.
We are not using a shopping cart as we are only selling subscriptions so the cart option would not work.
This would be great to have on the registration page.
Thank you, we love the plug-ins and hope this is possible, maybe even as an updated feature.
December 27, 2013 at 11:02 pm #59882admin
KeymasterThere is a shortcode that you can use on your registration page which will allow your users to optionally set the affiliate ID (giving credit for the sale to that affiliate). Check the following post for details:
August 11, 2014 at 7:58 pm #59883cyxou
MemberHi,
got similar problem here.
For some reason a site that I was hoping my users would post their affiliate links on is trimming the urls after the question mark. It also blocks all the shortened link produced by major url shorteners providers. So the solution in my case is to let users manually enter the affiliate ID into the registration form and make it required.
Is there a way to embed the [wp_aff_set_affiliate_id] shortcode into the registration form for a better user experience?
August 12, 2014 at 5:32 am #59884admin
KeymasterYou could create an information page where you send your affiliates first. Here is an example of a similar page that we use ourselves:
That is where we send our affiliates.
You could then use that shortcode to manually apply an affiliate ID in that page.
August 12, 2014 at 6:33 am #59885cyxou
MemberGood point! I’ll try this approach and see how it works.
Thanks again))
August 21, 2014 at 9:01 am #59886cyxou
MemberIt would be great if [wp_aff_set_affiliate_id] shortcode shows it’s form only when ap_id is not set. To implement this I had to use custom javascript function on my registration page:
setTimeout(function() {
var ap_id = jQuery.cookie('ap_id');
if (ap_id !== undefined) {
var input = jQuery('input[name="wp_aff_affiliate_id"]').val(ap_id);
input.prop('disabled', true);
jQuery('input[name="wp_aff_affiliate_id_submit"]').hide();
}
}, 500);October 13, 2014 at 1:58 pm #59887cyxou
MemberHi again!
Based on my users’ feedback, I want to make the Affialite ID field on the registration page the required field with checking if the provided username (ap_id) is a valid username, I mean the user who is already registered, the real user.
Need to say that I use WP-members plugin for registering users. I’ve set it’s filters so that when there is no ap_id cookie, the Referrer field is shown in the registration form thus the user is required to provide the referrer’s username. On submitting a form there is a check if the provided referrer is an existing user and if not, it shows the appropriate message. When the user fills in the real valid username in Referrer field, the filter creates a cookie with ap_id equals to referrer field and than it proceeds with the registration. All works perfectly and I like this user experience but the problem is that the registered user does not becomes the referrer’s referral. When I view the created user in WP Affiliate -> Edit Affiliate, the Referrer ID is always empty but when the successful registration message is shown, I can see that the ap_id cookie is set correctly.
Could you please help me to set things so that I could pragmatically set appropriate cookie in appropriate step during registration process or maybe there is a better way to do this?
Now when I’m writing this, an idea pops up in my mind to use internally in my filters your function that sets ap_id cookie in [wp_aff_set_affiliate_id] shortcode. Is it possible?
Thanks in advance.
Kind regards,
Alex
October 13, 2014 at 11:13 pm #59888admin
KeymasterHi Alex, your code to set the cookie is probably getting run AFTER the account creation code is executed.
After the registration form is, when do you set the cookie? What hook are you using to process your post form submission code?
October 14, 2014 at 10:46 am #59889cyxou
MemberHi,
I use the wpmem_pre_validate_form filter:
/* WP-MEMBERS set ap_id cookie with the referer value */
add_filter( 'wpmem_pre_validate_form', 'wpmem_set_ap_id_cookie' );
function wpmem_set_ap_id_cookie( $fields ){
setcookie('ap_id', $fields['aff_referer'], time() + (86400 * 30)); // 86400 = 1 day
return $fields;
}October 14, 2014 at 10:58 pm #59890admin
KeymasterAny chance you can send me a link to your registration page so I can see how your registration process works?
October 15, 2014 at 1:55 am #59891cyxou
MemberHere it is [http://goo.gl/CJrPIV]. Do not be afraid, it’s Russian
For the current time being I’ve removed the Referrer ID field until I find a solution to make it the required field with check for the existence of the username provided.
As for now the only chance for a user to provide a referrer is to use that referrer’s affiliate link which implicitly set the appropriate cookie.
October 15, 2014 at 5:40 pm #59892cyxou
MemberSo… if the ap_id cookie is not set and can’t be set prior form submission but the Referrer ID field exists in registration form, can I somehow automatically set a Referrer ID of the newly registered user with the help of the internal WP Affiliate functions like record_click?
October 15, 2014 at 6:25 pm #59893cyxou
MemberAs a workaround I think I can use jQuery to prevent the submiting of the form… Something like this:
$("form").submit(function (e) {
e.preventDefault(); // this will prevent from submitting the form.
$.cookie("ap_id", $('referrer selector').value(), { expires : 30, path : '/'});
// and then move forward with submiting the formAnd then goes the “wpmem_pre_validate_form” filter where I’ll check for the validity of the referrer id provided and if there is no such referrer, unset the cookie and return the appropriate message.
But I’d like to avoid dealing with javascript if it can be done with PHP.
October 16, 2014 at 12:54 am #59894admin
KeymasterI don’t understand russian. I tried to blindly fill in the form so I could go to the next page but it gave an error and I didn’t understand anything (since it is in Russian).
Do you send them to the affiliate registration page after they fill in that page?
October 16, 2014 at 3:20 am #59895cyxou
MemberNope, it’s the only registration page I have. I’ve simplified everything as I could. Once registered, the user becomes an affiliate also (Automatically Create Affiliate Account checkbox in WP User Settings).
-
AuthorPosts
- You must be logged in to reply to this topic.