Recording sign-up referrals

Since there have been several requests for an example on how to record a referral when an affiliate’s visitor has registered for an account, I’ve written an example plugin Affiliates Members which does just that.

1. Back-up your site and database.

2. Install and active the Affiliates plugin if you haven’t already.

3. Download the Affiliates Members example plugin, decompress the content and place it (a single file called affiliates-members.php) in your wp-content/plugins folder and then activate the plugin.

Now whenever a new user registers on your site, a referral will be recorded showing the new user’s name.

It’s a basic example on how to track sign-up referrals, so don’t expect more of it than just recording the new user’s name and other default data but this may actually be just enough for quite a few … comments, questions and intense cheers are, of course, welcome.

For those interested in how this works without wanting to bother with installing the example plugin, this is how it’s done:

add_action( 'user_register', 'affiliates_members_user_register' );
function affiliates_members_user_register( $user_id ) {
    if ( function_exists( 'affiliates_suggest_referral' ) ) {
        $userdata = get_userdata( $user_id );
        $data = array(
            'user-name' => array(
                'title'  => 'Username',
                'domain' => 'affiliates-members',
                'value'  => $userdata->display_name,
            )
        );
        affiliates_suggest_referral( get_the_ID(), __( 'New member', 'affiliates-members' ), $data );
    }
}

84 Responses to Recording sign-up referrals

  1. Sascha November 25, 2014 at 6:33 pm #

    Hi Antonio,

    I would like to track, when visitors subsribe to my newsletter. How can I do this? Is their a code I could put on my thank you page? Does the Thank You page to be one page of my site or is it also possible to use another one? I use MailChimp and use their Thank You Page.

    Is it possible to put WooCommerce later on the site and still now which affiliate partner sent the customer if someone from the newsletter buys a product?

    Thanks,
    Sascha

    • kento November 28, 2014 at 4:11 pm #

      Hi Sascha,

      Under Affiliates > User Registration you can track who referred whom, have a look at the settings there please when you have installed the plugin, it’s pretty straight-forward to use. Note that this requires them to sign up for an account, if they just subscribe to your newsletter without creating an account, then that won’t work.

      With WooCommerce, given that you plan to install it later on, the system would work the usual way. If someone refers a purchase, the affiliate gets credited accordingly. It doesn’t matter if the affiliate link is in a newsletter, via FB, etc.

      Cheers

      • Sascha November 29, 2014 at 4:49 pm #

        Hi Kento,
        yes, I know, that I understood. But I would like to track whether someone reaches a special page. I know other use something like tracking pixel or tracking code. How can I do this with Affiliates?
        Every subscriber is worth money and so I want to give my Afiliate money if they bring me subscribers. So I need this tracking code.
        Could I call the affiliates_suggest_referral function from this site and everything is fine?
        Cheers

        • kento December 1, 2014 at 12:43 pm #

          Hi Sascha,

          Thanks for clarifying that, sure that makes sense. Yes you can use affiliates_suggest_referral(...) to record this, see the Referrals documentation page for an example please.

          Cheers

          • Sascha December 1, 2014 at 2:04 pm #

            Hi Kento,

            thanks. Is it right, that this is only possible in the Pro or Enterprise Version?

            Cheers

            • kento December 1, 2014 at 9:33 pm #

              Hi Sascha,

              The example on that page yes, but you can also use the above function 🙂

  2. Afiffuddin October 29, 2014 at 6:14 pm #

    Did you offer affiliate tools or affiliate program or both (affiliate for your plugin)? Actually I came to your site through my friends blog. Look interesting.

    • antonio October 30, 2014 at 11:46 am #

      Hi,
      please have a look to the affiliate-area page.
      cheers

  3. Edgar October 17, 2013 at 5:02 pm #

    Hi Antonio,

    The shopper would reach the merchants site through our site.

    What solutions would make this experience, charity tracking possible?

    Thanks so much!

    • antonio October 18, 2013 at 8:10 am #

      Hi,
      you could use Affiliates with this plugin (Affiliates Members), and use Direct as “charity”, so, if a customer A goes to your page, and sign-up, then a commission is given to Charity (Direct), and then the user can go to the merchant site.
      You could hide the merchant url, and show the url only to members with Groups (in this case forces the users to register and generate commission).

  4. Edgar October 11, 2013 at 8:01 pm #

    Hi Kento et. al.,
    I admire your complete responses and robust followers. I have read your responses and hope my need is not too unique.
    I am not a wordpress expert but I can fiddle a bit.

    I am building an affiliate site where we will donate a portion of our commission from the merchant to the charity of the end-buyers choice.

    Ex; Bill finds out about our site through a cause he likes. Since he is shopping online anyway, he will go to that merchant through our site to make that purchase since he knows a % or $$ will go to a charity of his choice.

    We want to capture this person’s contact information so we can email him verification that we donated $$ on their behalf to the charity of his choice. We would also like to know how much that endbuyer is spending through our site.

    What is the best way to track this? Deepest Thanks and Hope, Edgar

    • Edgar October 11, 2013 at 8:45 pm #

      After seeing your Affiliates pro/Enterprise Jigoshop Integration youtube vid maybe I set up the charities as a referal? But I’d have to know that first or can this be done post purchase? Thanks again.

      • antonio October 17, 2013 at 4:33 pm #

        If the shop is in your page:
        – you could create an affiliate “charity”, that only get commissions when a customer has clicked her custom url.
        – Or use “Direct” as charity. In this case, all purchases generate commissions to charity (except if another affiliate url is used).

    • antonio October 17, 2013 at 4:30 pm #

      Hi,
      sorry, the shop is in your page, or in the merchants pages?

      • Miracle May 30, 2020 at 12:07 pm #

        Hello… I complained about not being able to track affiliates signups before. I was told to use ninja forms. I used ninja forms but when I tried activating it with affiliate registration before publishing, I could not find anything related to it. It was just store submission and others that were there. Contact form 7? I did, but could not create a signup and login page (if there’s a tutorial for that, please help me with it) formidable? Didn’t even work. Is there a way I could just integrate affiliates with a membership website? Or possibly just grant commissions on each affiliate signups (will still need tracking) please, help me thanks. I’m completely stucked at tracking. That’s what’s holding me back. Thanks.

        • Kento June 6, 2020 at 12:02 pm #

          Hi,

          As I’ve pointed out previously in this comment, if you follow the instructions to set up the form appropriately, the combination will work. For any issues that might occur on your setup, this would not be related to the combination of the Affiliates system with Ninja Forms, but would be due to issue that are created outside of the combination. Please have a look at the Troubleshooting section of the documentation – typical issues are covered there and from years of experience pretty much all issues can be tracked to those that are outlined there.

          Cheers

  5. ref August 26, 2013 at 6:00 pm #

    It’s great that your community is very good, I do not know why anyone is not replying me. I am frustrated since last 5 days. Every thing work fine , Hits and Visits work fine, but when a user register as new affiliate using other affiliate’s link than “Still no of referral is still ZERO” , This buddy has also same question but he is also not replied
    http://wordpress.org/support/topic/regarding-referral-status

    Please @kento or @antonio help me

    following link
    {http://www.itthinx.com/2011/07/11/recording-sign-up-referrals/}

    also did not helped me to work the only and measure problem is that why referral count is always ZERO
    Please Please help me

    • antonio August 26, 2013 at 6:54 pm #

      Sorry,
      this plugin must work fine. How do you count the referrals? Using [affiliates_referrals status="accepted"]?
      Beware with referrals status, the plugin creates a referral with status “pending”.
      cheers

  6. Dan July 17, 2013 at 5:48 pm #

    Hi,

    Thanks for the great plugin!

    Is there a way to track referral fee based on the order for users that registered through affiliates’ link?

    We need to allow distributors to give out links to their end-buyers, who will signup and order online. End of certain period (monthly), we are trying to give out the commissions to the distributors for any orders (not one-time) that have been placed by the end-buyers who signed up through the affiliate link.

    Basically, we are trying to give fee to the affiliates for any orders that has been placed by the customer referred by them.

    I would really appreciate, if you let me know how I can make this happen!

    Thanks in advance!

    • kento July 22, 2013 at 8:18 pm #

      Hi Dan,

      Many thanks for your feedback 🙂

      Do you mean to assign a customer to the referrer and give the referrer a commission on any purchase of the customer thereafter? What if the same customer is referred by another affiliate after that? Would you attribute the commission to the new referrer, or to the initial one? I think you will need a customized solution/addition to what is provided OOTB with the Affiliates or Affiliates Pro plugin.

      Cheers

  7. Jon April 11, 2013 at 1:06 am #

    Hey Kento!

    Brilliant plugin. Thank you for all your hard work 🙂

    A previous comment in this thread mentioned customizing the affiliate registration fields – This is what I am trying to do.

    I need to create 7 additional input fields. (company name, address, phone number, etc.) And I need them to be required fields.

    I’m working on trying to figure out your previously mentioned instructions right now.. but I am very much a beginner with PhP – so it’s proving difficult to understand.

    > Can I just add some code to affiliates-registration.php to obtain those extra fields? What exactly would that be?

    I know you must be very busy.. I would sincerely appreciate any help you could offer.

    Please feel free to contact me via email.

    Thank you again!

    • antonio April 11, 2013 at 5:36 am #

      Hi,
      the affiliate registration form is fixed and you can’t add any fields there unless you derive a customized version. The form is kept simple to make registration as easy as possible. Any additional information can be added to the user profile, see Useful plugins.

      cheers

  8. Brenda February 6, 2013 at 4:02 pm #

    Does this track those who sign up as an affiliate, or those who register as a user through the wp program?

    • kento February 11, 2013 at 6:14 pm #

      This example would make an entry when a new user who has been referred by an affiliate signs up.

  9. James galloway January 23, 2013 at 10:15 am #

    Hi Kento, first of all, awesome addition to the affiliate plugin(added [referrer_user] shortcode)! love it. couple of questions. How long until you have this in the pro version? plus, it is almost what I’m after… are you able to do short code to pull custom fields of a sponsor. As you know I have created a custom field for an affiliate to enter a user, I want to pull this user(custom field) for the referrer.

    Anyway buddy, another cheer for you, your plugin rocks and just keeps getting better.

    I know your a busy chappy, but hope to hear from you soon. Have a great day!

    Chears, James 🙂

    • kento January 26, 2013 at 11:56 am #

      Many thanks James 🙂 Yes it’s already in there as well.

      • 007oo7 February 1, 2013 at 2:26 pm #

        Much appreciate your patience and and help so far Kento. Thanks buddy 🙂 been going through all the docs including shortcodes and getting familiar with how it all works and am hugely impressed the more I learn.

        Anyway, to follow up further on my query… So far your info has been fab and I realized how close I am now with your shortcode:

        [referrer_user]

        This shortcode can be used to render information about the referring affiliate’s user account. The shortcode takes two optional parameters:

        direct – defaults to “false”, when “true” it will render information about the Direct affiliate when it applies.
        display – determines what to display; defaults to “user_login”; allowed values are “user_login”, “user_nicename”, “user_email”, “user_url”, “display_name”.

        The above code lets me pull sponsor info for the affiliate which is fab and I will be using this. However, this is so close to what I need. I simply want to pull a custom field in the same way… I have tried such things as this [referrer_user display="user_en_username" /] with en_username being the custom field. This simply pulls the sponsers username though. It was worth a shot lol 🙂

        Point is, because we are so close with this now can I be cheeky and ask you favour? would you be up for doing an update to this …[referrer_user]… so that we can pull custom fields? something like this [referrer_user display="user_CUSTOM_FIELD" /]

        Or contact me and hopefully arange some personal help. I have scanned the web, your docs, s2members docs, solid now so am not being lazy, I just feel you have what I need and we are very close.

        Much appreciated and look forward to an update Kento…

        By the way, deffo having the affiliate share plugin, looks awesome bud, have a fab day…

        James 🙂

        • kento February 11, 2013 at 5:34 pm #

          Hey James, that could be a nice feature, adding it on the todo list for the next release! 🙂

          • James galloway February 14, 2013 at 8:14 pm #

            hey that sounds good to me Kento, thanks buddy… In the meantime I am trying to fashion my own verison…. wow! lol. My thoughts are this so far. Until your possible update I can actually use the website field but would need to be able to 1)remove the http://(by default) 2) remove it from the signup form but be able to edit it from a profile edit field. Does that make any sense?

            So I could pull the entry Im after with this [referrer_user display="user_url"/]

            The URL field is of no use to me and I don’t want it during registration but do you agree that by entering it in a profile update this would acheive the same thing im after?

            Dont forget, the affiliates will not be getting their hands on their referral links until after they update their profile field(user_url)….

            Can I do this Kento?

            remove the website/url field from registration and then make it appear editable in profile after the affiliate is in?

            It still fulfills my needs and its already in place, I just need to tweak these things.

            1)how do I remove website/url field from registration?
            2)how do I remove the default value(http://)?
            3)how do I add it to the profile update field as editable?

            Anyway, will leave this with you while I learn more on the affiliate share plugin, cheers again buddy 🙂

            • kento February 15, 2013 at 9:56 am #

              Hi James,

              As the fields on the form that is provided are fixed, the best way to do this is to derive a custom version of the registration form. You can do this by using the form provided in lib/core/class-affiliates-registration.php, for example rename the class to Affiliates_Registration_Customized, in init() change

              add_shortcode( 'affiliates_registration', array( 'Affiliates_Registration', 'add_shortcode' ) );

              to

              add_shortcode( 'affiliates_registration_customized', array( __CLASS__, 'add_shortcode' ) );

              so that you can use the [affiliates_registration_customized] shortcode to render your own version of it. You would just have to remove the fields you don’t want in the code and you’re set 🙂

              Another way to do it would be to use a form you provide yourself which then uses one of the methods defined in the original class to create an affiliate entry. Once you have your user ID, you can call

              Affiliates_Registration::store_affiliate( $user_id, $userdata );

              The $userdata array expects to have entries for first_name, last_name and email.

  10. James Galloway January 16, 2013 at 9:53 am #

    Hi Kento, when you get chance, could you check out the message above. I do think you can help me on this, Many thanks.

    Have a great day buddy,

    James 🙂

    • James Galloway January 17, 2013 at 11:17 am #

      thanks for the above answer Kento. Still not fully understanding though, sorry bud 🙂

      I have just upgraded to your pro version as I like the look of the extras which come with that. I have everything working nicely together now and am just outstanding this one thing.

      I know you are probably a busy guy but if you get chance buddy would you be able to send me further info or even a step by step on your reply to my email. Its frustrating being so close lol.

      Thanks greatly buddy, much appreciated.

      • kento January 23, 2013 at 1:01 pm #

        Let me try it out myself and post a complete solution, sorry it took a while to get to this but the past days have been fully packed 😉

        • James Galloway January 25, 2013 at 11:23 am #

          Thank you Kento. I believe you almost have what I’m after already 🙂 super stuff buddy. Simply pulling any custom field data from that of an affiliates sponsor and displaying in the affiliates back office!

          I look forward to seeing more buddy.

          I know your busy so any time is good Kento. Have a great day 🙂

          • kento January 26, 2013 at 1:35 pm #

            Thanks James, have a great weekend 🙂 … time really flies 😉

      • kento January 25, 2013 at 8:59 pm #

        Hi James,
        I’ve finally got a chance to take a further look, I think you can use s2’s function get_user_field() to retrieve what you need. So for the sponsor you are using, you can modify the $data like this:

        $data = array(
        'user-name' => array( 'title' => 'Username', 'domain' => 'affiliates-members', 'value' => $userdata->display_name ),
        'en_sponsor' => array( 'title' => 'Sponsor', 'domain' => 'affiliates-members', 'value' => get_user_field( 'en_sponsor' )
        );

        • James galloway January 28, 2013 at 4:36 pm #

          super thanks for your help Kento… I know I should learn a lot more in this area but just a last quick question for you please.

          So If I have a custom field called ‘en_username’ which an affiliate would manually enter and submit this value, there referrals screen could display the username they entered into this field on there page by using the get code?… [s2Get user_field=”en_username” /] if I modify with the details above(your snippet of code)? One thing though… where am I modifying within my site?. Obviously at the moment that s2get shortcode pulls and displays the input username of the same affiliate user.

          I know I should really get my learning head on and teach myself more but am so close at solving this thanks to you…

          I also posted a question on your affiliate share plugin page. Many thanks Kento. Have a great day, 🙂

          • kento January 31, 2013 at 1:07 pm #

            Hey James,

            I’ll try to explain using the example with en_sponsor from before. When a referral is recorded, that field’s value is recorded along with the referral and you can show its value in the stats by adding the data parameter:

            [affiliates_affiliate_stats type="stats-referrals" data="en_sponsor"/]

            There are more options to that, please refer to Detailed referral overview in the documentation.

            Another case is when you are using the s2Get short code, then it will display the value of that field for the current user. See the difference?

            Cheers

    • kento January 17, 2013 at 11:17 am #

      Just got to it 🙂
      Cheers James

  11. James Galloway January 14, 2013 at 11:45 am #

    Hey Kento. Awesome plugin 🙂

    I am trying to do something similar. If I quickly explain you may be able to help.

    First off, I am only using the free version at the mo, will I need to upgrade with this following scenario.

    I have a website which runs a members plugin(which is perfect), I have included your affiliate plugin now(which works perfect with the member plugin). What I want to achieve is people join my site for free through a members referral link. Inside the back office I want to convert them to join another external money making platform(through the external platforms referral link which belongs to that of the sponsor), when joined they return to the back office with me and enter their username from the external platform which places it into the database which can then be pulled when they refer… this repeats!

    Does that make sense Kento, I do hope so.

    I am no expert here but believe I am very close to achieving what I’m after. With your help I think I can pull this off.

    Much appreciated in advance.

    James 🙂

    • kento January 14, 2013 at 12:22 pm #

      If I understand what you’re trying to do, you want referrals to be recorded when sales are made through an external platform. This would require an integration using the external platform’s API. That can involve quite an amount of consulting and development, depending no how that platform works, information that should be stored, payouts, …

      • James Galloway January 14, 2013 at 1:41 pm #

        Hello Kento, thank you for getting back to me.

        No, what I am after is something to pull the sponsors username from the database to display in the new referrals back office and/or finsih of a referral link with it.

        We are not trying to detect anything from the external platform as when somebody joins it, they simply return and place it in their back office.

        I have created new fields one being ‘en_username’ and the other ‘en_sponsor’ user. I am able to pull data from the database with this code [s2Get user_field=”en_username” /] and I am also able to add that to the end of their affiliate URL. However so far it is obviously displaying their own. I need it to pull that of their sponsor.

        So, It actually a simple system which is not going to be fully auto as I don’t intend to be communicating with the external comapnies data.

        So to hopefully explain it better. I send you my referral link to sign up free to my website, when inside there I convert you into joining an external platform and returning with the user id you created their to enter into your profile at my site. I obviously done this before you, so the data which is being called into your back office to create the link which you use to access the external platform is the user id i put into my profile(back office) before you. So this field [en_username] contains my username.

        I simply want to pull any data I choose(username) from a sponsors field to display in their referrals back office.

        please let me know if that makes any sense Kento lol 🙂

        • James Galloway January 14, 2013 at 1:50 pm #

          Just so its clear. I dont want to pull my websites user ID. I want it to pull the user ID from the field I created [en_username]. So it is pulling the username of the external platform which they manually entered when they returned to my site.

          All your help much appreciated 🙂

          • kento January 17, 2013 at 11:09 am #

            Ok that sounds a lot clearer now 🙂

            As long as you have a means of retrieving the value of the field, you can pass it along with the $data array – following the example on this page:

            $sponsor = ...; // retrieve the value of the sponsor's name
            $data = array(
            'user-name' => array( 'title' => 'Username', 'domain' => 'affiliates-members', 'value' => $userdata->display_name ),
            'sponsor' => array( 'title' => 'Sponsor', 'domain' => 'affiliates-members', 'value' => $sponsor )
            );

  12. Vladislav January 8, 2013 at 8:11 am #

    This plugin sounds great, and records referrals. But I need to see the exact user who has registered from a certain affiliate link (has been referred). It seems the plugin gathers this data, but I cannot seem to find where I can view it.

    • kento January 8, 2013 at 9:08 am #

      When you go to the Affiliates > Referrals section and check Expand details as well as Expand data, you will see the Username field recorded for each referral.

      • Vladislav January 8, 2013 at 11:27 pm #

        Thank you very much for the prompt reply! Works great!

  13. Scott December 23, 2012 at 2:59 am #

    I was wondering if there was a way to track referrals as webform submissions. I want to track submissions from individuals using unique affiliate links (which works great by the way), but I have not been able to get a form submission to track as a referral. Is this possible as it is currently set up? Thanks.

    • kento December 30, 2012 at 11:59 am #

      You can use the integration for Contact Form 7 or use the API to record referrals when your custom form is submitted.

  14. Ronnie October 6, 2012 at 1:34 pm #

    Will the Affiliate sign up work with an existing Membership site?

    For example, let’s say I already have a WordPress user registration form setup with another plugin. Can I automatically have them be registered as an affiliate using your plugin?

  15. Oscar July 23, 2012 at 10:31 pm #

    Really excellent plugin.
    Please try to improve it more.

    Kento, is it possible for a user to register in affiliate program directly?

    Is it possible to assign a specific affiliate link for everybody who register in our website?

    Take care,

    • kento July 24, 2012 at 9:08 pm #

      Hey Oscar, glad to hear you like the plugin. It’s being improved continuously thanks to all who use it and support its further development.
      Yes both are possible, have a look at the documentation.

  16. Ray Masa July 13, 2012 at 5:20 pm #

    Lets begin with intense cheers, thanks for the plugin, looks good. Added your registration plugin as well. Works well.

    Is there a way to add the affiliate id to the new user (in the wp user table)? This way when someone becomes a member, I would know which affiliate sent that person.

    Thanks,

    Ray

    • kento July 13, 2012 at 8:40 pm #

      Ahhh intense cheers sounds amazing 🙂 About your question, I see one fairly easy way to do that, but you would have to write a plugin that adds it as user meta when the new user is added. Is that an option?

      • Ray Masa July 13, 2012 at 10:44 pm #

        Wow, that was a quick reply. Love the support. Thanks.

        I think I got it to work. I found a plugin (http://blog.ashfame.com/2010/11/add-custom-field-registration-wordpress/) that kind of does what you were suggesting, essentially adding the data to the usermeta table (which is fine). I had to modify the plugin very slightly by setting a cookie in header and then retrieving that in both wp_login and the script from the above plugin.

        So far it works, needs to test more. My only concern is that I had to modify wp_login (to retrieve the cookie) and that’s not good as the modification will disappear in the next wp update.

        Any suggestion on how to get around that (I know that is not exactly your script).

        Thanks,

        Ray

        P.S. if you want to include the hack for this in your files, I would be happy to send that all to you.

        • kento July 13, 2012 at 10:53 pm #

          Thanks for getting back with your results as well 🙂
          I strongly advise not to hack WordPress core. It will be a PITA to maintain anyway. Do you really need the cookie? You can get the referring affiliate’s ID like this:
          $affiliate_id = Affiliates_Service::get_referrer_id();
          If you can use that to retrieve the referrer’s affiliate ID in the modified version of that plugin once a user registers, I think you’re ok.
          A pastebin of the code might be helpful to others, feel free to post a link if you want 🙂

          • kento July 13, 2012 at 10:55 pm #

            PS: You need to include class-affiliates-service.php before making the call.

          • Ray Masa July 17, 2012 at 1:14 pm #

            Sorry about not replying sooner, it all works correctly on the test server, but not on the production server. I spent two days trying to figure out why. I think there is something in the production server that is causing the issue, nothing to do with this script.

            As discussed, here is what I have done so far, and it works fine on the test server. In case someone else is looking for similar solution:
            – Download and install
            o Affiliates plugin (http://wordpress.org/extend/plugins/affiliates/)
            o Affiliates Members (http://www.itthinx.com/wp-content/uploads/2011/07/affiliates-members.zip)
            o Custom Registration Fields plugin (http://blog.ashfame.com/2010/11/add-custom-field-registration-wordpress/)
            – Modify Custom Registration Fields to add whatever field you would want to for the affiliate
            o Note that you probably would need to have the affiliate field in the Custom Registration Field as hidden. If you have an affiliate id in the URL, the will work fine. However, if you do not have an affiliate id in the URL, your registration form won’t work (it will ask for an affiliate id). You would need to add a statement to check for an empty field to deal with that as well.
            On the test server, I used cookies to store the affiliate id, in which case, you would need to set cookies in the header.php for the theme you are using. Here is a simple example on how to set a cookie in header:

            But as you suggested Kento, using affiliate id as below would be better:
            $affiliate_id = Affiliates_Service::get_referrer_id();
            I got distracted with trying to figure out the issue with production server, so have not yet tested the above implementation.

            As noted earlier, I had also modified the wp-login file, which is not really a good thing, as pointed out by Kento. Plus, I didn’t really needed to modify that, not sure why I did that to begin with. No need to touch that file.

            Hope this helps. Back to tearing my hair out trying to figure out my production server.

            • kento July 17, 2012 at 1:56 pm #

              Thanks for the update on your progress.
              What differences are there between the test and the production server? If you could state some details (including OS, MySQL and PHP versions) we might get a clue to what’s wrong on the production server. Also do make sure that the code base on both deployments is exactly the same.

        • Ray Masa July 18, 2012 at 3:16 am #

          Both test and production have the same version of wp install as well as php and mysql. The only difference is that the product version got lots more plugins, and I suspect one of these plugins is cause the issue.

          The way I set it up is that when a visitor first comes to the website,the url will have an affiliate id (domain.com?affiliate=2). On this page (via header.php), I set a cookie to store the affiliate id. That works. When a visitor goes to a different page, the url does not have the affiliate id, but that’s ok because the id is stored in the cookie. And that works on all the pages on the website, except on the register page (domain.com/wp-login.php?action=register). For some reason the cookie disappears on that page, but only on the production server (works fine on the test server).

          I suspect one of the other plugins might be causing this. But before I turn all the plugins off to see which one, I will try your solution (Affiliates_Service::get_referrer_id();) and see if that solves it.

          Ray

          • kento July 18, 2012 at 9:53 am #

            Yes, definitely try that first.

  17. Rohit Manglik June 24, 2012 at 5:32 am #

    I am trying to use the API as mentioned above but I am getting following error message.

    Call to undefined function wp_get_current_user() in /hermes/waloraweb068/b592/moo.oprotechcom/careerbreeder/wp-content/plugins/affiliates/lib/core/wp-init.php on line 785

    WordPress version 3.4

    I am using following code

    function affiliates_members_user_register( $user_id ) {
    if ( function_exists( ‘affiliates_suggest_referral’ ) ) {
    //$userdata = get_userdata( $user_id );
    $data = array(
    ‘user-name’ => array(
    ‘title’ => ‘Username’,
    ‘domain’ => ‘affiliates-members’,
    ‘value’ => “test”,//$userdata->display_name,
    )
    );

    affiliates_suggest_referral(“2”,’New member’, $data );
    }
    }

    affiliates_members_user_register(2);

  18. Martin June 21, 2012 at 5:07 pm #

    When a new affiliate signs up on a website say on http://www.x.com, do they get a link something like this http://www.x.com/hhfyhss that they can send to their friends on social media and when their friends click on the link it tracks back to the registered affiliate?

    • kento June 26, 2012 at 11:26 am #

      There is a specific affiliate registration form for that so they can sign up as an affiliate for a site.

  19. Chris Alexander January 24, 2012 at 2:03 am #

    Thanks for the plugin. I have not used it yet but understand the features and from what I have read so far its going to be just want I needed

  20. Koqui January 23, 2012 at 2:43 am #

    Awesome plugin. Everything including this small code works Great. But I want to give credit when a contact form is filled. Currently I am using Custom Contact Forms by Taylor Lovet, and looking for a function to add to this code. Example
    add_action( ‘ccf_add’, ‘affiliates_members_user_register’ );
    function affiliates_members_user_register( $user_id ) {
    if ( function_exists( ‘ccf_add’, ‘affiliates_suggest_referral’ ) ) {
    $userdata = get_userdata( $user_id );
    $data = array(
    ‘user-name’ => array(
    ‘title’ => ‘Username’,
    ‘domain’ => ‘affiliates-members’,
    ‘value’ => $userdata->display_name,

    So Affiliate gets credit for “lead” and not for new user. But its not working as I want, Any suggestions would be great.

    • kento January 23, 2012 at 11:21 am #

      I haven’t worked with that plugin but there are two things that you should check/modify:
      – Does this ccf_add action really pass the $user_id?
      – Remove this: “if ( function_exists( ‘ccf_add’, ‘affiliates_suggest_referral’ ) ) {” this will certainly evaluate to false every time.
      Also there will be an integration with Contact Form 7 if you’re interested in using that plugin as an alternative.

  21. lochoe October 30, 2011 at 7:38 pm #

    I just post a new job at freelancer.com , http://www.freelancer.com/projects/PHP-Javascript/Wordpress-referral-downline-sales-cart.html

    is there have any relation for this plugin…

    • kento October 30, 2011 at 7:42 pm #

      Yes, looks like you could use Affiliates to drive this with appropriate integration.

  22. jeff winner October 16, 2011 at 7:58 pm #

    Hello, I wondering if you have any special pricing for the affiliate pro version for non profits. We are Motivate 2 Learn a registered 501 (C3)and we provide learning tools, motivation and more to schools (most under privileged). We want to start an affiliate program for fund raising purposes.
    Thank you

    • kento October 16, 2011 at 8:58 pm #

      Hi Jeff,

      It’s my pleasure to support your work and cause. I just forwarded it. Please let me know if you need help.

      Cheers

  23. JL August 31, 2011 at 8:06 pm #

    What Bryan & Patricia said above is exactly what I’m looking for Kento. I need my affiliates to be able to see their stats and commissions (I need to see this data too)

    • kento August 31, 2011 at 8:48 pm #

      The stats feature is on it’s way, of course you can already see the commissions on the referrals page if the data is recorded correctly.

    • xposed March 19, 2013 at 7:52 am #

      This add on will be great on my site. Would it show live statistic on the admin side?

      • kento March 19, 2013 at 10:37 am #

        Yes, you can already try that out as well by installing the free Affiliates plugin.

  24. JL August 20, 2011 at 11:31 am #

    I agree with the comments above. I desperately need to be able to do that with this plugin. I love how easy it is to add affiliates.

    • kento August 20, 2011 at 12:24 pm #

      Thanks for your comment JL, what exactly do you need the plugin to do? Are you referring to affiliates being able to sign up directly?

  25. Bryan July 13, 2011 at 9:44 am #

    Nice!! Seems to work for me!! So for a completely unrelated question…..are there any short codes to add affiliate data (clicks; referrals) to a page/post?

    • kento July 13, 2011 at 10:19 am #

      Shortcodes for that are not yet available, because up to now the intent was to provide information on the back end. If there is enough interest for an API (including shortcodes) that allows to pull off data for pages and visualize it there, then this can be included in a future release.

      • Bryan July 13, 2011 at 1:34 pm #

        I definitely think the ability to track how much the affiliates have made and a front-end for their campaigns would be logical (and really cool!) If anyone wants to do that now, you just have to use the dashboard and some permission tricks 🙂 works like a charm.

      • Patricia Reszetylo August 18, 2011 at 11:55 am #

        ABSOLUTELY!!! Affiliates need to know they can personally go to their stats. This (and adding the affiliates members to the plugin), and something that allows people to automatically get set up (or to sign up on their own) would be greatly appreciated.

        • kento August 18, 2011 at 12:03 pm #

          Thanks for your comment Patricia, some of these features are scheduled to be implemented quite soon. On top of the list is for affiliates to be able to sign up directly.

Leave a Reply

We use cookies to optimize your experience on our site and assume you're OK with that if you stay.
OK, hide this message.

Affiliates · Contact · Jobs · Terms & Conditions · Privacy Policy · Documentation · Downloads · Useful Plugins · My Account

Share