Title: php snippet samples
Last modified: November 11, 2022

---

# php snippet samples

 *  Resolved [msamavi](https://wordpress.org/support/users/msamavi/)
 * (@msamavi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-snippet-samples/)
 * Hi,
 * Can you please provide simple usage examples of the following hooks:
 * is_logged_in_using_ipbl()
    ipbl_can_auto_login ipbl_auto_logged_in
 * Thank you.

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

 *  Plugin Author [brijeshk89](https://wordpress.org/support/users/brijeshk89/)
 * (@brijeshk89)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-snippet-samples/#post-16192870)
 * Sure. Please find the examples below :
 *     ```
       if(is_logged_in_using_ipbl()) {
       echo 'user is logged in via Plugin';
       } else {
       echo 'you need to login';
       }
   
       add_filter('ipbl_can_auto_login', 'my_can_auto_login', 10000, 1);
   
       function my_can_auto_login($return){
   
       	// Do some validation 
       	// if you want to allow auto login return true 
       	// if you want to disallow auto login return false
   
       	return true;
       }
   
       add_filter('ipbl_auto_logged_in', 'my_post_ipbl_auto_login, 10000, 2);
   
       function my_can_auto_login($user, $logged_in_range){
   
       	// This function is called after a user is just auto logged in by IP Based Login plugin
       	// It will be called only once per session after the session is created
   
       	// $user will have all the details of the user into which the visitor was logged in
   
       	// $logged_in_range will have the IP range from the allowed ranges in which the user's IP matched
   
       	// No return required
       }
       ```
   
 *  Thread Starter [msamavi](https://wordpress.org/support/users/msamavi/)
 * (@msamavi)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/php-snippet-samples/#post-16192965)
 * Thanks very much [@brijeshk89](https://wordpress.org/support/users/brijeshk89/)

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

The topic ‘php snippet samples’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/ip-based-login.svg)
 * [IP Based Login](https://wordpress.org/plugins/ip-based-login/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ip-based-login/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ip-based-login/)
 * [Active Topics](https://wordpress.org/support/plugin/ip-based-login/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ip-based-login/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ip-based-login/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [msamavi](https://wordpress.org/support/users/msamavi/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/php-snippet-samples/#post-16192965)
 * Status: resolved