@@ -15,7 +15,7 @@ final class SS_Disable_User_Login_Plugin {
1515 *
1616 * @var string
1717 */
18- private static $ version = '1.3.4 ' ;
18+ private static $ version = '1.3.5 ' ;
1919
2020 /**
2121 * Plugin singleton instance
@@ -135,6 +135,7 @@ private function add_hooks() {
135135 add_filter ( 'bulk_actions-users ' , array ( $ this , 'bulk_action_disable_users ' ) );
136136 add_filter ( 'handle_bulk_actions-users ' , array ( $ this , 'handle_bulk_disable_users ' ), 10 , 3 );
137137 add_filter ( 'user_row_actions ' , array ( $ this , 'add_quick_links ' ), 10 , 2 );
138+ add_filter ( 'wp_is_application_passwords_available_for_user ' , array ( $ this , 'maybe_disable_application_passwords_for_user ' ), 10 , 2 );
138139
139140 } //end function add_hooks
140141
@@ -160,6 +161,22 @@ function add_quick_links( $actions, $user_object ) {
160161 return $ actions ;
161162 }
162163
164+ /**
165+ * Prevent users with disabled accounts to use application passwords.
166+ *
167+ * @param bool $allow Whether to enable application passwords for the user. Default true.
168+ * @param WP_User $user user that is trying to access application passwords.
169+ *
170+ * @return bool true if application passwords should be enabled, false if it should be disabled.
171+ */
172+ function maybe_disable_application_passwords_for_user ( $ allow , $ user ) {
173+ if ( $ this ->is_user_disabled ( $ user ->ID ) ) {
174+ return false ;
175+ }
176+
177+ return $ allow ;
178+ }
179+
163180 /**
164181 * Gets the capability associated with banning a user
165182 * @return string
0 commit comments