What should I do when I'm locked out?

Emergent Functionality

When you are locked out by misfortune, this feature inhibits the blocking behavior of this plugin.

Download IP Geo Block, unzip and open the ip-geo-block.php with an appropriate editor. You can find the “Emergent Functionality” code section near the bottom of the file as follows:

<?php
/*----------------------------------------------------------------------------*
* Emergent Functionality
*----------------------------------------------------------------------------*/


/**
* Invalidate blocking behavior in case yourself is locked out.
*
* How to use: Activate the following code and upload this file via FTP.
*/

/* -- ADD `/` TO THE TOP OR END OF THIS LINE TO ACTIVATE THE FOLLOWINGS -- *
function ip_geo_block_emergency( $validate ) {
$validate['result'] = 'passed';
return $validate;
}
add_filter( 'ip-geo-block-login', 'ip_geo_block_emergency', 1, 2 );
add_filter( 'ip-geo-block-admin', 'ip_geo_block_emergency', 1, 2 );
// */

This code block can be activated by replacing /* (opening multi-line comment) at the top of the line to // (single line comment), or * at the end of the line to */ (closing multi-line comment).

<?php
/*----------------------------------------------------------------------------*
* Emergent Functionality
*----------------------------------------------------------------------------*/


/**
* Invalidate blocking behavior in case yourself is locked out.
*
* How to use: Activate the following code and upload this file via FTP.
*/

//* -- ADD `/` TO THE TOP OR END OF THIS LINE TO ACTIVATE THE FOLLOWINGS -- *
function ip_geo_block_emergency( $validate ) {
$validate['result'] = 'passed';
return $validate;
}
add_filter( 'ip-geo-block-login', 'ip_geo_block_emergency', 1, 2 );
add_filter( 'ip-geo-block-admin', 'ip_geo_block_emergency', 1, 2 );
// */

After saving and uploading it into ip-geo-block in your plugins folder (typically /wp-content/plugins/) via FTP or cPanel File Manager, you become to be able to login again as an admin.

Then you can re-configure “Maching rule” and “Country code for matching rule” at “Validation rule settings” properly. After that, do not forget to restore the ip-geo-block.php on your server to the original one.

If you have no confidence in editing PHP file, please download ZIP from here and use it that “Emergent Functionality” is already activated.

Deactivate by force

Although the above processes is strongly recommended at your emergency, some users are not familiar with this type of jobs.

In that case, you can rename ip-geo-block folder to ip-geo-block.bak using FTP or something. Then you cal login and see the following message on your plugin’s dashboard.

Force to deactivate

After renaming ip-geo-block.bak to the original, you can activate this plugin again.

Another solution at emergency

You can also just forcibly remove ip-geo-block in your plugin’s folder. Then you’ll see the same message as the above picture on your plugin’s dashboard.

After that, you can reinstall through “Add New” button and reactivate again. But you’ll find soon you’re blocked again because your settings still remains in your database.

Blocking message

But don’t worry about that. A background process kicked by the activation will rescue you. After pausing for breath, you can visit your admin dashboard again!

Warning: Do not delete ip-geo-api directory. If you do that, this solution becomes never to work.

For power users

If you’re familiar with the use of phpMyAdmin and know where the plugin’s options are saved, you can change the value of matching_rule to -1 which means Disable. Please do it at your own risk.

Change matching_rule via phpMyAdmin