For Developers

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:

<?php
add_filter('dokobit_register', function ($allow, $users, $response_arr) {
if (some_custom_condition()) {
return false;
}
return $allow;
}, 10, 3);


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:

<?php
add_filter('dokobit_login', function ($allow, $user_id, $response_arr) {
$user = get_user_by('id', $user_id);

if ($user && in_array('customer', (array) $user->roles, true)) {
return true;
}

return false;
}, 10, 3);


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:

<?php
add_filter('dokobit_redirect', function ($redirect_to, $user_id, $response_arr) {
return home_url('/my-account/');
}, 10, 3);


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
  • 0 Els usuaris han Trobat Això Útil
Ha estat útil la resposta?

Articles Relacionats

IonCube Errors

If you are getting IonCube errors while installing the plugin please try the followingPLEASE NOTE...

Uppsetning á Dokobit WP rafrænni auðkenningu

Uppsetning á WordPress Dokobit Identity Gateway plugin   Viðbótin býður upp á auðvelda leið...

Setup instructions - WordPress Dokobit Identity Gateway

WordPress Dokobit Identity Gateway – Secure electronic identification   An easy solution for...