I’ve been looking for an affiliate tracking plugin for wordpress and couldn’t find a single one. There are numerous plugins available that let you track the performance and manage affiliate programs that you have signed up for, but I was looking for the exact opposite: letting your signed up users refer new members and get credited for it.
I decided to write my own plugin for it, which I have just submitted to the wordpress.org plugin repository. It still needs to be approved for publication on the site, but you can already download it here.
The plugin lets your signed up members send traffic to any page on your wordpress site, appending ?affid=username to the end of the url (replacing username with their own username on your site) If someone registers on your site, the referring member will get credit for the new member. The plugin also lets you specify a page you want people to be send to after logging in (instead of the wordpress admin panel)

Thanks Nico. That’s a great idea. I’ve downloaded and will be using it on my blog.
Thanks for this plugin
A little idea for you : Add on the member profile how many referer_by are done with his link
Hi,
This sounds absolutely perfect Nico. Just what ive been searching for! I just hope it does what it says on the tin. If this works as expected I will definetely donate to you for this one.
Im almost overjoyed and alittle aprehensive at the same time. Feel like im one of the first ones testing it oout, but looking at stats its been downloaded 282 times from wordpress and who knows how many from here or elsewhere. And of course it is only a couple of weeks old!
Does this plugin play with the core files/theme in anyway? Anything to be worried about?
Should I download 1.0 or the dev version? What changes have been made to the dev?
ok forget that for a minute, after first test this seems to work a charm.
I will now take down my extended form referred by, or at least remove the field from the users profile page.
Is there anyway u think I could add the referred by and referred to the users profile, I can add extra fields easily enough so can just do it manually following the info this plugin gives me mind.
Also, where does this leave us in regards to SEO benefits of the affiliate links, ie having the ?affid=username at the end of the urls. Cookie tracking is of upmost importance, but the added benefit of gaining the link love is certianly a consideration for us. We want the traffic and users first, but we certainly want the link love aswell you know. What are your thoughts on this?
Maybe I can change the ? to # to avoid this duplicate content issues, not sure how though? some playing with the plugin files I imagine.
Also im not sure the rel=can is gonna work/help really, reading some bad stuff about it, so its gonna have to be a 301 on all affiliate links I think, do you have any recommendations about going about his?
Sorry for the multiple posts.
Phil
Phil, thanks for sharing your thoughts on the plugin, it enables me to improve it.
When writing the plugin, I didn’t spend much thought on SEO. The plugin was created for a specific purpose and it works like intended. Since SEO is a very important aspect for most webmasters some things will definitely be changed in future releases of the plugin in this field.
I have just read about a new parameter handling tool in Google Webmaster Tools. This seems to be the solution for your proposed problem. At least for the Goolge search engine (are there any others???)
A ‘referred by’ field on the userprofile page will be added in the next release.
Hi thanks for the reply, I will keep a close on on the updates of this and upgrade accordingly.
Couple more questions:
Is it possible for me to change the parameter affid to something alittle friendlier like shareid, camid, or whatever you know.
How are the cookies being set, ie if I set up a 301 on all affid urls are the cookies gonna stick in place? I know this prob depends upon the 301 set up, ie I need to tell it redirect but keep session data, but just interested in whether how the cookie/plugin data is built wil have an effect on me running this route.
Veyy noob school but maybe if I just change the following instances of affid (these are the only I can see)
if(isset($_GET['affid'])) {
$affid = $_GET['affid'];
global $wpdb;
// set cookie
setcookie(‘affiplus’, $affid, $exp, ‘/’, $affp_domain[0]);
}
}
to whatever I want it to be? Is that about the size of it?
Phil, I’ve added a few fields to the profile page earlier today. Version 1.1 is available to download.
I will look into incorporating the 301 redirect into the plugin.
If you want to use something different from affid, you found the right place to change. A word of advise though: it’s best not to change plugin files directly as the next time you upgrade the plugin your changes will be overridden and will have to be applied again. I will make the affid parameter changeable on the settings page in the next release.
Nico, thanks for that! I will grab the 1.1 now and give it go.
Yeah I understand re making changes to the plugin files/code, but probably will go ahead and do so anyway -) Also if this option is being incorporated in the next release I guess I’ll only have to change it this once anyway eh! -)
The 301 would be a good touch indeed. I use allinoneseo and this has it set up for can issues etc already, guess this would have to play nice with that eh (if infact they have anything to do with one another).
As before, ill keep an eye on this page and the plugin itself.
Thanks again, your a legend.
Hi, I dont know how soon (if not already im gonna piss you off). And whether or not you want me to take this to the wordpress location of the plugin. So please advise accordingly.
In the new version (1.1)
The profile fields appear, but they do not display any data, ie they show a “-” regardless of whether or not data should be pulled into them. I have tested this for both the “referred by” field and the “number of members referred” field.
Are these working for you?
Also still in regards to the profile fields, these dont get called up in my plugin, cimy-user-extra-fields, So I have no way of controlling them. It would be ideal if we could control not only the section title (currently Affiiate plus, but the titles for each of the fields aswell, along with the messages etc
On the same note the referral URL is shown ok, i.e http://www.site.com/?affid= but of course it is not adding the users name onto the end of that URL, if we had control of the text below it however this could be mentioned here, ie id say something like, add your user name to the end of the URL etc etc.
Cheers for all your hard work sir. Sorry again to be a bother.
Phil
Also as a side note, I know all of the text and titles can be changed by editing the plugin files echos/outputs, so I can ammend it there.
So this is more a issue for making the plugin user friendly and easy for everyone in the future.
But the info/data called into those sections not working is obviously beyond my tinkering with the core files -)
Phil
Man, I’ve got to install the block-phil plugin so you stop bothering me!
Seriously though, your feedback and thoughts are very much appreciated. I like my plugins to be of value to many wordpress users and without feedback they would only have the options that I think are useful to me. Hey, half the shit in the Ad Buttons plugin was added by user request and it is becomming a very nice plugin. Closing in on 20,000 downloads must mean something!
Well, back to the Affiliate Plus plugin: I see my ‘referred by’ and ‘members referred counter’ updated. All features are working fine for me before I release them into the wild, but that’s when stuff that I would have never thought of testing go wrong, so I’m very interested in why it doesn’t work for you…
When registering a new user, it should show the referring user name right under the e-mail field of the signup form. Does that show up for you?
Also, my profile page shows the http://www.site.com/?affid= link with the username in place like intended on two different wordpress installations that I use for testing
Hey. Yeha that would be a nice plugin!
Ok, strangely now on the profile page, it has updated the users referred field, and now shows a number (1) instead of nothing as before. But however it shows this for both a user with no referrals and a user with referrals!
The referred by field is still blank, regardless of whether or not they were referred or not by blank i mean”-”.
In the backend, it is all working as expected though as per before.
On the registration page there is now the name of the refferal id under/next to the email field. This I would like to avoid having if possible. Unless I can have that auto fill into a field, I guess if I sort it with some css (ie if it is wrapped) then it will be fine.
But again the profile pages are not updating.
You can test this for yourself if you can be arsed.
http://www.pipthepip.com/?affid=kellpot
This may be something to do with my set up though of course.
I thought I add quickly that, I am testing this all on one machine, so maybe that has something to do with it, maybe the cookies info is getting squewed somehow? although that said, it works at the back end, so that probably doesnt make any sense, cause if it works one place then its just a case of replicating that info somewhere else eh, maybe more to do with my in page pofiles/no backend for users.
I’ve just signed up through your affiliate link and I can see the problem, it shows that I have referred one new member and I’ve not been referred by anyone. Very strange… Are you running the latest version of wordpress?
Have a look in your database the plugin should have created a affp_referrals table in your wordpress database with two columns: affp_id should list the user id number of the referred user (this is the ID found in the wordpress users table) and the second column lists the referral name (should be equal to a user_login from the wordpress users table)
I see the referral id shows up on the signup form, so everything works fine setting and retrieving the cookie
What do you see on the users list when logged in as admin? The list of names should have two new columns (referred by and referred) filled with a name and number respectively.
Yes strange! Im using 2.84, so no not the very latest, but close.
The admin is displaying al information correctly.
I have the two new fields and the info in each is correct. For example nico was reffered by kellpot and nico2 was reffered by nico i think -) But either way the info is correct in the admin>users.
It is just when the data is being pulled to the profile pages we are having the problem.
I will check my db now and get back to you in quick order.
Update, yes the DB has created all you listed. affp_referrals table with two columns: affp_id & affp_referral
listing numbers(ids) and usernames respectively.
The thing is, like I mentioned above, as the admin page is displaying the correct info, its not a case of the cookies/pplugin not working properly, its just that the data isnt ppulling into the profiles as expected right?
I will say as just another little thought, having the affiliate id show up on the registration page is quite a good idea, but probably not the best. For this reasoning mainly, I want the option for offline users to be able to refer to use, they can only do so by a referral ID, so therefore the xtra form field I have, being referral ID is neccesary. And with that in mind having the name listed, unless again (I can float it into the actual field itself is not ideal).
That said, when offline users reffer, the client will not see the referral id by the email (or wherever I place it) – so its not a huge issue, but for people being reffered online, they will see the name and the field, kinda double whammy, especially when you think that I wil aim to float it below the field box it up and add a title, reffered by to it, if left.
If you catch my drift. -)
But either way, for now this profile issue is obviously more pertenent -)
Boy o boy Im a swine eh.
The possibility to manually enter a referral id would be a nice touch. How about this: if a cookie is found, the referral id is taken from it and placed into the box without the user being able to change it. If no referral link has been used to get to your site, the box is an input field where the visitor can manually enter a referral id.
One thing I have noticed in your profile page is the fact that the information isn’t displayed in the same order as on a standard wordpress profile page: the affiliate plus part is normally shown before the name part of the profile, your page shows it all the way at the bottom. How did your get the profile page to look like that? If it’s some other plugin, I’d like to test it on one of my test sites.
Hey that sounds like a good idea.
My profile page…I use ‘theme my profile’ plugin & ‘cimy-user-extra-fields’ plugin.
I think the former is what is outputting it like that. But cimy user certianly lets u add and remove fields easily enough.
Any more news on the movements of this plugin Nico? As it stands I need to find a way to remove the fields being outputted on the profile pages, as were giving out mis-information which could cause us problems. I will look to, for the mean time, just add the referral data manually for the info this plugin provides us. If you could help out with that, it would be much appreciated.
Cheers
Hi again -) Im losing my mind here, trying to work out how to echo the number of referrals each user has, so im trying to display this info when they are logged in, not on the profile page, but on a custom page. Im an idiot when it comes to this stuff, and I figure you will obv know best, ive got to the point of realising its a global wpdb thing as apposed to just calling and echoing from the profile (cause nothing seems to work for me there) But whatever I try I cant get it to run.
By the way, I know I want to know how to remove this info from the profile fields and show it elsewhere, but currently the profile fields for rerred b arnt working at all, but number of referrals is just counting the total count, so I guess the info is not getting called correctly per user which is effecting both.
Please feel free to delete some of these comments Nico. After a good long stint trying to get this to work, I have finally got it outputting the correct numbers!!! WoopeeDoo eh. I guess I learnt a few things along the way, but probably not much -) I have gone ahead and reverted back to the 1.0 version as a simple solution to getting rid of the fields on the profile pages. And I will just use the info on a custom page as desired.
That said, I have no clue about the ramifications of this use, caching and pos security issues that may arise, but hey ho for now it is at least letting me show the number that the admin/user pages already had on show.
That ‘theme my profile’ plugin you are using messes up the additional information on the profile page. I have been trying to get it to output the correct values, but it seems next to impossible.
Good to hear that you got the information on a separate page now, I’ll make the information on the profile page selectable in the plugin settings. A few other improvements are pretty much done, so look out for an upgrade!
Don’t worry about downgrading to 1.0, the profile page fields where the only addition to the 1.1 version
Thanks Nico, sorry to hear youve wasted time trying to fix it for use inline with that partiular plugin, I may end up not using it and styling the profiles without the use of a plugin soon enough anyway.
I will say though, that it was outputting full values, ie total number of referrals, instead of per user, when I first got this to display on a seperate page using generally your plugin code ripped up. ie the count bit.
When I changed:
(“SELECT COUNT(*) FROM $table WHERE affp_referral = ‘$user_info->user_login’”)
to
“SELECT COUNT(*) FROM $table WHERE affp_referral = ‘$current_user->user_login’”
It started to output as per the logged in user as required, I assume this would work for the profile page itself aswell? Thing is you had it working on your test sites, so dont see why it would mine woould be diffent, even out of reach oof the profile page?
Doesnt need saying but obv the missing brackets is a c and p error, the change was purely from $user_info->user_login to $current_user->user_login -)
Hi, Nico
May I know where I can get login’s form for this plugin?
Thank you
Dawan, this plugin extends the standard wordpress signup function. So, after activating the plugin users sign up as they would without the plugin. Do make sure that you have selected the ‘anyone can register’ option under settings->general in the wordpress admin panel or the ‘register’ link will not show up on the login form.
Thank you for your replay, It’s working right know.
I tray to register with gmail is successfully but yahoo mail is never receipt username and password.
The registration mail that is send out is just standard wordress doing its thing. Looks like yahoo is blocking the mail, which could have different causes:
- they might block all wordpress registration mails
- mail from your domain or server is blocked. Check if your servers ip address or your domain is black-listed
see if you can specifically white-list your server or your wordpress from-address in your yahoo account.
What a great plugin. It’s very promising.
Two questions:
1. How I can show a user’s referral count and referred by info to any registered user on a blog? The info would be shown on author.php.
2. Is it possible to create a best of – list of user’s with most referrals? A widget maybe, visible to every visitor on a blog.
I will look into adding the referral count to the author page. A ‘top referrals’ widget is also on my list of things to add in a future release of the plugin.
Great to hear! I hope you’ll find a way soon…
Hi Nico,
Like your plugin
I want ask you that I have installed your plugin to my WP blog, and when I test him, its didn’t worked..
I was tried test by registration under my referral and its didn’t show any referrals under him, althogh I confirmed in email.
Can you please help?
Just amazing your plugins!
Thanks,
Liav
I must says that all the information on the plugin or in my WP is OK.. But still have this problem.
I wish you can help me
Thanks!
Liav, did you see the referral id field filled on the signup form?
Hi Nico,
Thanks for contacting back !
I have tested this again according what you said me, but still… same problem.
Is your Plugin custom to specific subscribe plugin?
Thanks again!
Liav
OHH I just checked again and I understand whats was the problem..
Thank you!
Excellent, I’m glad you’ve worked it out. Care to share what was going wrong? Other people might run into the same problem, so it would be nice to have your solution listed here.
Thanks Nico!
The problem was that I was found the referral field on the regual WP registration, instead on my subscribe users plugin. Then its work!
Your’e Great man
Hi Nico,
Thanks for your plugin, its great!
I hope you can add some feature in future release, like:
- a widget to show referrer photo, maybe you can combine with “user photo” plugin
- added some referrer profile data like email in user profile
- email notification to referrer that someone has sign up on his referral
I wish I could contribute some script idea but I don’t understand a bit about programming
Thanks before Nico!
Thanks for the ideas, they have been added to my list of things to add to the plugin.
Have you seen this?
Mingle WordPress Plugin
Integrate these and you got a winner!
Hi!
I have trouble using the plugin. I changed the tracking code to tips and created a new user after going to umea.ungdomsportal.se/?tips=admin
At the registration-page, I could see admin as referral but when I later checked as admin, I didnt have any referred. I used two different computers and cleared cookies before registration.
Any idea what went wrong?
André
I tried your url, but I don’t see any cookie. Did you disable the plugin again?
Hi!
Yes, I removed the plugin. I tested it with two more computers and it didnt work.
I have activated it again if you would like to take a look. This time, I use the default ID, affid.
Thanks
André
Hello
I’ve tried the plugin on a WP 2.8.6 version, it doesn’t work …
When I use a referral link to register, the cookie is present & the affid is in the field, but nothing show up in the user list row.
I use the default settings for the plugins etc.. No idea why it don’t work :/
I’ve one quick asking for you.
How I refer someone to register into my affiliate?