FLW Point System
Who It’s For
- Site owners who want a lightweight points ledger without a bulky “gamification suite.”
- Developers needing a dependable API to award or deduct user points.
- Product teams validating loyalty, rewards, or engagement systems before building full UX.
Why This Plugin
- Simple by design: Clean ledger table, cached balances, and minimal admin UI.
- Developer-first: Small, predictable surface with clear helper functions and hooks.
- Auditable: Every change is logged with plugin name, reason, and optional context.
- Performance-aware: Uses stored running balances in user meta for fast reads.
Key Features
- Points ledger: Dedicated table with delta, running balance, plugin, reason, context, and timestamps.
- Helper functions:
flw_points_add_points( $user_id, $points, $plugin, $reason = '', $context = null ); flw_points_spend_points( $user_id, $points, $plugin, $reason = '', $context = null ); flw_points_get_balance( $user_id ); - Admin UI: Dashboard cards and a searchable Points Log with filters by plugin and user.
- Settings: Option to allow or prevent negative balances.
- Hooks:
flw_points_transaction_loggedflw_points_addedflw_points_spent
Requirements
- WordPress 6.0 or newer
- PHP 7.4+ (8.x recommended)
- MySQL 5.7+ or MariaDB 10.2+
- Permission for the plugin to create a database table on activation
Compatibility
- Theme-agnostic; no frontend output by default.
- Works alongside membership, LMS, or community plugins as a backend points service.
- Multisite not officially tested (recommended for single-site installs).
- No REST/AJAX endpoints by default; intended for server-side or custom integration.
What It’s Not
- ❌ A full gamification platform (no badges, levels, or quests).
- ❌ A WooCommerce/LMS points replacement (no checkout tie-ins out of the box).
- ❌ A frontend widget library (you’ll build your own UX).
- ❌ A REST API—no external endpoints unless you add them.
- ❌ An anti-fraud system—implement your own rate limits and rules.
Quick Start
1. Install & Activate
- Upload and activate the plugin.
- On activation, it creates the ledger table and default settings.
- Go to FLW Plugins → FLW Point System to access the Dashboard, Settings, and Points Log.
2. Configure
- In Settings, choose whether to allow negative balances.
3. Award or Spend Points in Code
// Add 50 points
flw_points_add_points( $user_id, 50, 'my-plugin', 'Completed profile', 'profile' );
// Spend 20 points
flw_points_spend_points( $user_id, 20, 'my-plugin', 'Redeemed reward', 'reward-123' );
// Read current balance
$balance = flw_points_get_balance( $user_id );
4. Listen for Events
Add custom logic using these hooks:
flw_points_transaction_logged
flw_points_added
flw_points_spent
5. Review Activity
Use the Points Log to search and filter by user or plugin for full audit visibility.
6. Extend (Optional)
Add REST routes or custom UI components if you need frontend or external interactions.
