Title: Asking for extending
Last modified: August 30, 2016

---

# Asking for extending

 *  Resolved [digiblogger](https://wordpress.org/support/users/digiblogger/)
 * (@digiblogger)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/asking-for-extending/)
 * Hi.
    Great plugin. But I need a little extension so maybe you can read this as
   a feature request.
 * Basicly I want to stop registrations from outside my country.
    But, and that 
   is the difference, if a user is member I want to allow login from anywhere.
 * And it must work with standard wp and buddypress/bbpress logins and registrations.
 * Do you think that you could add this.
 * I think it could be solved if there would be one page with just login and pw 
   reset Form that is accessible from outside my country
 * [https://wordpress.org/plugins/ip-geo-block/](https://wordpress.org/plugins/ip-geo-block/)

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/asking-for-extending/#post-6223373)
 * Hi [@digiblogger](http://www.digiblogger.de/),
    Thank you for your good proposal!
   I also want that feature because I’ll sometime go abroad on business 🙂
 * Yes, I think I can imprement that feature. For example, `login` can be selected
   from three choices, “`Disable`“, “`Block by country at registration`“, “`Block
   by country`“.
 * I keep this thread open until I implement the feature in the future.
 * Please feel free to post further proposal if you have.
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/asking-for-extending/#post-6223472)
 * Hi [@digiblogger](http://www.digiblogger.de/) and all,
 * While I’m now dedicating to design and implement codes, I’ll show the other solution
   here.
    The use case is slightly different from the proposal.
 * **USE CASE**
    - White list of Country Code is “`JP`“
    - Additional Country Code which you want to give permission for login is “`US`“
 * Here is the codes in your `functions.php`.
 *     ```
       /**
        * The whitelist of country code which is only permitted to login/logout.
        *
        */
       $my_login_whitelist = array(
           'US', // should be upper case
       );
   
       add_filter( 'ip-geo-block-login',   'my_permit_login' );
       add_filter( 'ip-geo-block-admin',   'my_permit_logged_in' );
       add_filter( 'ip-geo-block-comment', 'my_permit_logged_in' );
   
       /**
        * Permit only 'login' and 'logout' with specific whitelist of country codes.
        *
        * The following condition doesn't permit 'register', 'resetpass', 'lostpassword'.
        * |--------------------------------|-----------------------------------------|
        * |           Condition            |        Examples of requested URI        |
        * |================================|=========================================|
        * |empty( $_REQUEST['action'] )    |wp-login.php, wp-login.php?loggedout=true|
        * |--------------------------------|-----------------------------------------|
        * |'login' === $_REQUEST['action'] |wp-login.php?action=login                |
        * |--------------------------------|-----------------------------------------|
        * |'logout' === $_REQUEST['action']|wp-login.php?action=logout               |
        * |--------------------------------|-----------------------------------------|
        */
       function my_permit_login( $validate ) {
           global $my_login_whitelist;
   
           if ( in_array( $validate['code'], $my_login_whitelist ) ) {
               if ( empty( $_REQUEST['action'] ) ||
                    'login'  === $_REQUEST['action'] ||
                    'logout' === $_REQUEST['action'] ) {
                   $validate['result'] = 'passed';
               }
           }
   
           return $validate; // 'result' should be empty to be validated by country code
       }
   
       /**
        * Permit only logged in user with specific whitelist of country codes.
        *
        */
       function my_permit_logged_in( $validate ) {
           global $my_login_whitelist;
   
           if ( in_array( $validate['code'], $my_login_whitelist ) && $validate['auth'] ) {
               $validate['result'] = 'passed';
           }
   
           return $validate; // 'result' should be empty to be validated by country code
       }
       ```
   
 * Enjoy!!
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/asking-for-extending/#post-6223527)
 * Hi digiblogger and all,
 * I impremented what digiblogger proposed. Check out the [release note 2.1.1](http://tokkonopapa.github.io/WordPress-IP-Geo-Block/changelog/release-2.1.1.html)
   to see the details.
 * If you find any issues, please open a new ticket at this forum.
 * Thanks!!
 *  Plugin Author [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * (@tokkonopapa)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/asking-for-extending/#post-6223528)
 * I close this issue.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Asking for extending’ is closed to new replies.

 * ![](https://ps.w.org/ip-geo-block/assets/icon-128x128.png?rev=1148568)
 * [IP Geo Block](https://wordpress.org/plugins/ip-geo-block/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ip-geo-block/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ip-geo-block/)
 * [Active Topics](https://wordpress.org/support/plugin/ip-geo-block/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ip-geo-block/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ip-geo-block/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [tokkonopapa](https://wordpress.org/support/users/tokkonopapa/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/asking-for-extending/#post-6223528)
 * Status: resolved