Part 1 - Clarification
Here is part of what you wrote in your own comment (below the question now):
Event: after user becomes a member
Condition: user was referred by another user
Action: award points to user ( this is where I have issue....I can't find the 'referring-user' from data selector)
Refer to the feature request (not bug ...) "Rules Action: Fetch Referring User", which states the following:
Referral's Rules integration doesn't have a way to do that natively - the 'referring_user' variable only exists when the new account is being created. It would be very nice to have a Rules action that could fetch the referring user.
This issue, in status "needs review", does have a patch via which you may get it to work.
Part 2 - As-good-as-it-gets alternative
Here is the rule (in Rules export format) that you can use as a prototype, to partially answer your question:
{ "rules_award_userpoints_to_referring_users" : {
"LABEL" : "Award userpoints to referring users",
"PLUGIN" : "reaction rule",
"OWNER" : "rules",
"REQUIRES" : [ "rules", "userpoints_rules", "referral" ],
"ON" : { "referral_recorded" : [] },
"DO" : [
{ "userpoints_action_grant_points" : {
"user" : [ "referring-user" ],
"points" : "50",
"tid" : "0",
"entity" : [ "new-user" ],
"description" : "You earned some points because user [referring-user:name] just registered using referral link [referring-user:referral-link].",
"operation" : "New referral occured",
"display" : "1",
"moderate" : "default"
}
}
]
}
}
I've selected an (arbitrary) amount of 50 points. If you tune that to fit your own requirement, then these points will be rewarded (already) when that new account is created (with no relationship/dependency about becoming a member).
Be aware that the Rules / User Points integration has way more facilities you can take advantage of (that's why I consider this sample rule as a prototype only).
You should be able to use the Rules UI to perform an import of the above (exported) rule, provided you first enabled these modules (as indicated also within the REQUIRES section of the exported rule above):
- Rules, and the Rules UI sub-module, to further tune this rule if needed.
- User Points, and its sub-module "Userpoints rules integration".
- User Referral ... of course ...
Part 3 - Heading for the golden cradle
If you'd add an entity reference field to your user accounts (for entity type = user), you could replace the Rules Action from Part 2 by adding a reference to the "Referring user" (and not yet grant those user points).
Next you could create an additional rule based on an event like "After saving a new membership" (which you get from the Membership Entity module). And possibly you may want to add a Rules Condition to that rule to perform a Data Comparison about the membership-entity:type
, to check if it matches the membership type for which you want to grant the user points.
Finally you could use a Rules Action to grant the user points, similar to the Rules action as in part 2. But with the referring-user
(within the Rules Action from Part 2) replaced by the user indicated via the user reference indicated in the user profile.
If you're not familiar (enough/yet) with Rules, then checkout the 32 (!!!) great, and free, video tutorials Learn the Rules framework.