Setting Up Referrals
Overview
Sociable includes a built-in referral system that allows users to invite others and earn points for successful referrals. Each user receives a unique referral code that can be shared.
How Referrals Work
- Referral Code Generation: Each user receives a unique 8-character referral code when their profile is created
- Sharing: Users share their referral code or personalized referral link
- Registration: New users register using the referral code
- Tracking: The system links the new user to their referrer
- Rewards: Points are awarded to the referrer
User Referral Codes
Automatic Code Generation
When a user profile is created, Sociable automatically generates a unique 8-character referral code:
| Field | Description |
|---|---|
| referral_code | Unique uppercase alphanumeric code (e.g., A1B2C3D4) |
| referred_by | User ID of the person who referred them |
Finding Your Referral Code
Users can find their referral code in their profile:
- Go to Profile
- Navigate to Settings or Referrals section
- Copy the referral code or link
Referral Link Format
The referral link format:
https://yoursite.com/register?ref=CODE
Where CODE is the user's 8-character referral code.
Referral Points
Setting Up Referral Points
Configure points rewards for successful referrals:
- Go to Components → Sociable → Points Rules
- Click Sync Rules to import default rules
- Find or create the
referralrule - Configure:
| Field | Recommended Value |
|---|---|
| Rule Name | com_sociable.referral |
| Title | Successful Referral |
| Points | 20-50 (your preference) |
| Daily Limit | 0 (unlimited) or set limit |
Points Triggers
| Event | Who Earns | Typical Points |
|---|---|---|
| User registers via referral | Referrer | 20 |
| Referred user completes profile | Referrer | 10 (bonus) |
Tracking Referrals
Admin View
View referral statistics:
- Go to Components → Sociable → Users
- View the Referred By column
- Click on a user to see who they referred
User Statistics
Users can track their referral stats:
- Total referrals made
- Points earned from referrals
- Recent referral activity
Enabling the Referral System
Step 1: Enable User Plugin
The User plugin processes referral codes during registration:
- Go to System → Manage → Plugins
- Enable User - Sociable
- Ensure "Auto Create Profile" is enabled
Step 2: Configure Points
Set up points rewards:
- Go to Components → Sociable → Settings → Gamification
- Enable Points System
- Go to Points Rules
- Configure the referral rule with desired points
Step 3: Enable Registration
Ensure registrations are allowed:
- Go to Components → Sociable → Settings → Profiles
- Enable Allow Registration
SDK Integration
Award referral points programmatically:
$sociable = Sociable::getInstance();
// Award referral points to the referrer
$sociable->points()->award('com_sociable.referral', $referrerId, [
'target_type' => 'user',
'target_id' => $newUserId,
'description' => 'Referred a new user',
]);
Database Structure
Referral data is stored in the #__sociable_users table:
| Column | Type | Description |
|---|---|---|
| referral_code | CHAR(8) | Unique referral code |
| referred_by | INT | User ID of referrer |
Best Practices
Promotion
- Display referral codes prominently in user profiles
- Create a dedicated referral page
- Include referral links in email signatures
Incentives
- Offer meaningful point rewards
- Consider tiered bonuses for multiple referrals
- Create referral-based badges
Preventing Abuse
- Monitor for self-referral attempts
- Set reasonable daily limits if needed
- Verify new user accounts are legitimate
Badges for Referrals
Create badges to reward top referrers:
| Badge | Criteria |
|---|---|
| First Referral | 1 successful referral |
| Growing Network | 5 referrals |
| Community Builder | 25 referrals |
| Ambassador | 100 referrals |
Create rules in Components → Sociable → Badge Rules using the referrals metric.
Troubleshooting
Referral Code Not Working
- Verify the code exists and is valid
- Check user hasn't already registered
- Ensure registration is enabled
Points Not Awarded
- Confirm referral points rule is published
- Check User plugin is enabled
- Verify Points system is enabled
Missing Referral Link
- User profile may not be created yet
- Check user has a valid referral_code in database
Next Steps
- Points System - Configure referral rewards
- Badge System - Create referral badges
- Getting Started - Initial setup