How to Make a Link with a Member’s ref_id in the URL
With the Member Credits System add-on, it is possible to assign referral credits to members who refer to new sign-ups.
When the "Assign Referral Credits to Members Who Refer New Sign Ups" setting is enabled under Membership Plan Settings:
An additional field on the checkout page of the membership plan will display, with the default wording "Did Someone Refer You? Enter Referral ID Below":
When the ID number of the member is specified here, the member will receive the credit amount specified under the "Credits Assigned to Referring Member" membership plan setting:
It is possible to auto-populate the member ID# on this checkout form, using a dynamic link that would display as Custom Dashboard Content.
To accomplish this, first, create a new widget under Widget Manager:
Using the following snippet of code:
<a href="/<?php echo $w['default_checkout_url']?>/<?php echo $subscription['custom_checkout_url']; ?>?referral_id=<?php echo $user_data['user_id'];?>">Referral Link</a><br><br>
Very important note: The code above contains a dynamic URL. This means the system will recognize automatically the membership plan URL and there is no need to create one widget per membership plan.
The same widget can be placed on all of them.
Now that the widget is created using the code specified above, it can be called on the preferred membership plans using the Custom Dashboard Content:
Which would display on the member dashboard as shown below:
This link will auto-populate the Referral ID field on the checkout form as shown below:
NOTE: If the member that's logged in tried to use this link a message will appear letting them know they're already logged in. This link is meant to be copied and then shared with others that don't have an account yet, and take them to the checkout page and automatically load the member referral link.