Apologies for the combined bug and feature request.
Our organization is looking to use a module like this for our production sites to help keep them secure. It looks like this module is fairly new, but it is the most relevant module for our needs.
Being new, it does not look like this module would be ready for a security review by the Drupal security team. I'm hoping to help push block_inactive_users to a production-ready release.
I will be submitting a patch shortly that adds a checkbox and function for removing users whose `Last Access` is never, and makes several formatting and code fixes.
Here's what the drupal-check tool found:
------ ----------------------------------------------------------------------
Line src\Controller\ReactivateUserController.php
------ ----------------------------------------------------------------------
104 Call to deprecated function drupal_set_message():
in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
108 Call to deprecated function drupal_set_message():
in Drupal 8.5.0 and will be removed before Drupal 9.0.0.
Use \Drupal\Core\Messenger\MessengerInterface::addMessage() instead.
------ ----------------------------------------------------------------------
------ ----------------------------------------------------------------------
Line src\InactiveUsersHandler.php
------ ----------------------------------------------------------------------
191 Call to deprecated method url() of class Drupal:
as of Drupal 8.0.x, will be removed before Drupal 9.0.0.
Instead create a \Drupal\Core\Url object directly, for example using
Url::fromRoute().
------ ----------------------------------------------------------------------
------ ------------------------------------------------------------------------
Line tests\src\Unit\InactiveUsersHandlerTest.php
------ ------------------------------------------------------------------------
Class Drupal\Tests\UnitTestCase not found and could not be autoloaded.
------ ------------------------------------------------------------------------
[ERROR] Found 4 errorsPlease also review the warnings on pareview: https://pareview.sh/pareview/https-git.drupal.org-project-block_inactive...
Hope I'm not stepping on toes, but I've taken it upon myself to fix and improve several things here, except for the deprecated call to `\Drupal::url` in InactiveUsersHandler.php. I can open a separate issue for that.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | block_inactive_users-code-feature-update-3066831-update.patch | 7.77 KB | adambernstein |
Comments
Comment #2
adambernstein commentedThis patch updates the following:
- Checkbox/option to remove users who have never logged in
- Adds hook_help() and updates Readme.md
- Fix unused `use` statement and adjusts help text in SettingsForm
- Replace deprecated drupal_set_message() function with Messenger
Comment #3
adambernstein commentedOops, I just realized my previous patch would not work. Updated here, use this one instead.
Comment #5
rawdreeg commentedThank you very much for you contribution. I have tested your patch (Thanks for resubmitting by the way) and I have added that in.
R
Comment #6
rawdreeg commented