Title: Exclude Users functionality
Last modified: September 6, 2024

---

# Exclude Users functionality

 *  Resolved [monkeydisko](https://wordpress.org/support/users/monkeydisko/)
 * (@monkeydisko)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/)
 * Hi Tom,
   I’ve just bought you a beer. Exactly the plugin I was looking for, thank
   you very much!One question:I would like to block users who have not yet confirmed
   their e-mail address. I have a column ‘email_verified_at’ in my external users
   database for this purpose. It contains either a date or nothing (NULL).In the
   settings for ‘Exclude Users (BETA)’ I have entered ‘email_verified_at’ and left
   value empty. However, users with an unconfirmed account are still logged in.Am
   I doing something wrong?
 * Thank you!
   Sascha
 * ![](https://i0.wp.com/kegelbuddy.de/exclude_users.png?ssl=1)

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

 *  Plugin Author [tbenyon](https://wordpress.org/support/users/tbenyon/)
 * (@tbenyon)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18001070)
 * Hey there Sascha,
 * I’ve not worked on this plugin for some time so apologies that my answer may 
   not be perfect.
 * As that is a beta feature it may not work, however it may not work well with 
   the empty state.
 * What I would be more confident would work would be the `exlog_hook_filter_custom_should_exclude`
   hook. Here’s the notes on it from the documentation:
 *     ```wp-block-code
       - exlog_hook_filter_custom_should_excludeThis hook allows you to add custom logic to exclude users.It provides you with all the data for the user that is stored in the external database users table.If you return true (or a string - see below regarding custom error messages) from this function it will prevent theuser logging in, and returning false will bypass this exclusion.For example, let's say your external users table had a field called expiry which stored a date. In this example wewant to block users if they login after their expiry date.Adding the following to your functions.php would achieve this:<br>function myExlogCustomExcluder($userData) {<br>return strtotime($userData['expiry']) < strtotime('now');<br>}<br>add_filter('exlog_hook_filter_custom_should_exclude', 'myExlogCustomExcluder', 10, 1);<br>Alternatively if you provide a string the user will be blocked and the string will be used as the error for the user.<br>function myExlogCustomExcluder($userData) {<br>return strtotime($userData['expiry']) < strtotime('now') ? 'Your account has expired' : false;<br>}<br>add_filter('exlog_hook_filter_custom_should_exclude', 'myExlogCustomExcluder', 10, 1);<br>
       ```
   
 * The below code is what I imagine would work for you but I haven’t done any testing.
 *     ```wp-block-code
       function myExlogCustomExcluder($userData) {    return empty($userData['email_verified_at') ? 'Your e-mail has not been verified' : false;}add_filter('exlog_hook_filter_custom_should_exclude', 'myExlogCustomExcluder', 10, 1);
       ```
   
 *  Plugin Author [tbenyon](https://wordpress.org/support/users/tbenyon/)
 * (@tbenyon)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18001078)
 * … and I forgot to say – Thank you for the beer 🙂
 *  Thread Starter [monkeydisko](https://wordpress.org/support/users/monkeydisko/)
 * (@monkeydisko)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18001708)
 * Thanks, Tom! The Code you provided is working for me. 🤗
   A closing bracket was
   missing `empty($userData['email_verified_at'])`, but otherwise it works exactly
   as it should.Thank you very much!
 *  Plugin Author [tbenyon](https://wordpress.org/support/users/tbenyon/)
 * (@tbenyon)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18001788)
 * Fantastic news. Good luck with your project.
 * If you get a minute to [write a review ](https://wordpress.org/support/plugin/external-login/reviews/#new-post)
   I’d be very grateful.
 *  Thread Starter [monkeydisko](https://wordpress.org/support/users/monkeydisko/)
 * (@monkeydisko)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18003033)
 * Done. 🥳
   Thanks again.

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

The topic ‘Exclude Users functionality’ is closed to new replies.

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

 * 5 replies
 * 2 participants
 * Last reply from: [monkeydisko](https://wordpress.org/support/users/monkeydisko/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/exclude-users-functionality/#post-18003033)
 * Status: resolved