Hey @geckonet,
I have just tested this and it is working completely as expected my end using 1.7.1 and 5.2.1.
Once you change the setting in the plugin to make that user role blocked you should get an error next time you try to login that says “You are not allowed access”.
In case you’re interested and technically minded you can see the logic for this feature in this file:
login/authenticate.php
$block_access_due_to_role = true;
foreach ($roles as $role) {
if ($role != EXLOG_ROLE_BLOCK_VALUE) {
$block_access_due_to_role = false;
}
}
// If a user was found
if ($response) {
// If role is blocking user access
if ($block_access_due_to_role) {
$user = new WP_Error('denied', __("You are not allowed access"));
Are you sure you’ve written the role to be blocked in the same CaSe as it is in the database?
To help you diagnose further you could modify the snippet of code I shared with you above to the following and then look at your php error logs to see what it is doing:
$roles = exlog_map_role($response['role']);
$block_access_due_to_role = true;
error_log('---------EXLOG: STARTING ROLE CHECKING---------');
error_log('---EXLOG: ROLES:');
error_log(var_export($roles, true));
foreach ($roles as $role) {
error_log('-----EXLOG: ROLE:');
error_log(var_export($role, true));
error_log('-----EXLOG: CHECK:');
error_log(var_export(EXLOG_ROLE_BLOCK_VALUE, true));
error_log('-----EXLOG: ARE THEY NOT EQUAL?:');
error_log(var_export($role != EXLOG_ROLE_BLOCK_VALUE, true));
if ($role != EXLOG_ROLE_BLOCK_VALUE) {
$block_access_due_to_role = false;
}
}
error_log('-----EXLOG: FINAL - Should we block em?!');
error_log(var_export($block_access_due_to_role, true));
error_log('---------EXLOG: END ROLE CHECKING---------');
// If a user was found
if ($response) {
This shows in my error logs when I do NOT have a blocked role set in the external database:
[15-Jun-2019 13:15:14 UTC] ---------EXLOG: STARTING ROLE CHECKING---------
[15-Jun-2019 13:15:14 UTC] ---EXLOG: ROLES:
[15-Jun-2019 13:15:14 UTC] array (
0 => 'administrator',
)
[15-Jun-2019 13:15:14 UTC] -----EXLOG: ROLE:
[15-Jun-2019 13:15:14 UTC] 'administrator'
[15-Jun-2019 13:15:14 UTC] -----EXLOG: CHECK:
[15-Jun-2019 13:15:14 UTC] 'exlog_block'
[15-Jun-2019 13:15:14 UTC] -----EXLOG: ARE THEY NOT EQUAL?:
[15-Jun-2019 13:15:14 UTC] true
[15-Jun-2019 13:15:14 UTC] -----EXLOG: FINAL - Should we block em?!
[15-Jun-2019 13:15:14 UTC] false
[15-Jun-2019 13:15:14 UTC] ---------EXLOG: END ROLE CHECKING---------
This shows in my error logs when I do NOT have a blocked role set in the external database:
[15-Jun-2019 13:17:02 UTC] ---------EXLOG: STARTING ROLE CHECKING---------
[15-Jun-2019 13:17:02 UTC] ---EXLOG: ROLES:
[15-Jun-2019 13:17:02 UTC] array (
0 => 'exlog_block',
)
[15-Jun-2019 13:17:02 UTC] -----EXLOG: ROLE:
[15-Jun-2019 13:17:02 UTC] 'exlog_block'
[15-Jun-2019 13:17:02 UTC] -----EXLOG: CHECK:
[15-Jun-2019 13:17:02 UTC] 'exlog_block'
[15-Jun-2019 13:17:02 UTC] -----EXLOG: ARE THEY NOT EQUAL?:
[15-Jun-2019 13:17:02 UTC] false
[15-Jun-2019 13:17:02 UTC] -----EXLOG: FINAL - Should we block em?!
[15-Jun-2019 13:17:02 UTC] true
[15-Jun-2019 13:17:02 UTC] ---------EXLOG: END ROLE CHECKING---------
Tom