REST API
Base: /wp-json/oregister/v1/
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /auth/login | None | Login with username + password |
| POST | /auth/register | None | Register new user |
| POST | /auth/magic-link | None | Request magic link email |
| POST | /auth/magic-verify | None | Verify magic link token |
| POST | /auth/2fa/verify | WP session | Submit 2FA code |
| GET | /social/callback/{provider} | None | OAuth callback |
| GET | /profile/{user_id} | Optional | Public profile |
| PATCH | /profile | WP auth | Update own profile |
| GET | /gamification/stats | WP auth | XP, level, streak, badges |
| GET | /gamification/leaderboard | Optional | Top users |
| GET | /gamification/badges | WP auth | User's earned badges |
Action Hooks
php// Auth events
add_action( 'oregister_user_registered', function( int $user_id, string $method ) {} );
add_action( 'oregister_user_logged_in', function( int $user_id, string $method ) {} );
add_action( 'oregister_login_failed', function( string $username, string $ip ) {} );
add_action( 'oregister_ip_locked', function( string $ip, int $duration ) {} );
// Social
add_action( 'oregister_social_linked', function( int $user_id, string $provider ) {} );
add_action( 'oregister_social_login', function( int $user_id, string $provider ) {} );
// Gamification
add_action( 'oregister_xp_awarded', function( int $user_id, int $points, string $event ) {} );
add_action( 'oregister_badge_awarded', function( int $user_id, string $badge_slug ) {} );
add_action( 'oregister_level_up', function( int $user_id, int $new_level ) {} );
Filter Hooks
php// Modify XP awarded for an event
add_filter( 'oregister_xp_for_event', function( int $xp, string $event, int $user_id ): int {
return $xp;
}, 10, 3 );
// Modify badge criteria
add_filter( 'oregister_badge_criteria', function( array $criteria, string $badge_slug ): array {
return $criteria;
}, 10, 2 );
// Override login redirect URL
add_filter( 'oregister_login_redirect', function( string $url, int $user_id ): string {
return $url;
}, 10, 2 );
// Add custom social providers
add_filter( 'oregister_social_providers', function( array $providers ): array {
$providers['discord'] = [ 'label' => 'Discord', 'class' => 'MyDiscordProvider' ];
return $providers;
} );