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 );
}
}

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?
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.
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.
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.
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.
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.
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?
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)
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.
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
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
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…
Yes, looks like you could use Affiliates to drive this with appropriate integration.
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.
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.
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
Great