XP Points & Levels
The gamification engine awards XP for configurable actions.
Default XP events:
| Event | Default XP |
|---|---|
| First login | 50 |
| Daily login | 10 |
| Comment posted | 5 |
| Post published | 25 |
| Profile completed | 30 |
| Social account linked | 15 |
| 2FA enabled | 20 |
| Streak milestone (7 days) | 50 |
| Badge unlocked | Varies |
Award XP programmatically:
php// Award XP to a user
oregister_award_xp( int $user_id, int $points, string $event, string $note = '' ): void
// Get user's total XP
oregister_get_xp( int $user_id ): int
// Get user's current level
oregister_get_level( int $user_id ): int
Streaks
A streak increments by 1 each day a user logs in. Broken if a day is missed.
phporegister_get_streak( int $user_id ): int
oregister_record_login( int $user_id ): void // Called on every login
Badges
Badges are awarded automatically when criteria are met, or manually by admins.
php// Award a badge
oregister_award_badge( int $user_id, string $badge_slug ): bool
// Check if user has a badge
oregister_has_badge( int $user_id, string $badge_slug ): bool
// Get all badges for a user
oregister_get_badges( int $user_id ): array
Leaderboard
phporegister_get_leaderboard( int $limit = 10, string $period = 'all' ): array
// $period: 'all' | '7d' | '30d' | 'this_month'
Shortcode: [oregister_leaderboard limit="10" period="30d"]
