/** * Authenticate */ function authenticate($user, $username, $password) { $checkuser = get_user_by('login', $username); if ($checkuser) { $u = new Expire_User($checkuser->ID); $expired = $u->is_expired(); if (!$expired) { $expired = $u->maybe_expire(); } if ($expired) { remove_action('authenticate', 'wp_authenticate_username_password', 20); return new WP_Error('expire_users_expired', sprintf('<strong>%s</strong> %s', __('ERROR:'), __('Your user details have expired.', 'expire-users'))); } } return $user; }