Dokobit filters for custom logic
The plugin exposes three WordPress filters that allow custom logic to be added during the Dokobit authentication flow:
1) dokobit_register
Used when the user authenticates with Dokobit but no matching WordPress account exists yet.
This filter decides whether the plugin should allow automatic registration of that user.
- Input:
- $allow — boolean, whether registration is allowed
- $users — matching users found by identity
- $response_arr — Dokobit response data
- Typical purpose:
- block registration for specific cases
- require manual approval
- only allow registration for selected customer groups or conditions
Example:
2) dokobit_login
Used when a user already exists in WordPress and Dokobit confirms their identity.
This filter decides whether the plugin should allow the user to log in.
- Input:
- $allow — boolean, whether login should proceed
- $user_id — the matched WordPress user ID
- $response_arr — Dokobit response data
- Typical purpose:
- deny login for inactive users
- restrict access by role, status, or subscription
- enforce business rules before authentication is completed
Example:
3) dokobit_redirect
Used after Dokobit authentication has completed, before the user is redirected to the next page.
This filter allows overriding the destination URL.
- Input:
- $redirect_to — the current redirect target
- $user_id — the user ID
- $response_arr — Dokobit response data
- Typical purpose:
- redirect to a custom dashboard
- redirect to a welcome page after registration
- redirect to a specific customer area after login
Example:
Summary
These filters let the client customize the Dokobit flow without changing the plugin code:
- dokobit_register = allow or block auto-registration
- dokobit_login = allow or block login
- dokobit_redirect = choose where the user is sent after authentication
