Needs work
Project:
Role Expire
Version:
4.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
25 Nov 2019 at 10:37 UTC
Updated:
13 Oct 2025 at 09:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
rcodinaWhich version of Drupal core and module are you using? If you recently upgraded the module version, remove the fields and re add them.
Comment #3
rcodinaI need more info to help you. Feel free to reopen.
Comment #4
rcodinaComment #5
nchristensen commentedI am experiencing this issue using Drupal core 8.9.13 and Role Expire 2.0.0.
Encountering the Broken/missing handler views message and the same log message when I try to add "Role expiration date/time" as filter in a view.
Warning: Invalid argument supplied for foreach() in Drupal\views\Plugin\views\filter\Broken->buildOptionsForm() (line 56 of /code/web/core/modules/views/src/Plugin/views/BrokenHandlerTrait.php)Warning: Invalid argument supplied for foreach() in template_preprocess_item_list() (line 1107 of /code/web/core/includes/theme.inc)Comment #6
rcodina@nchristensen Have you tried to delete and then add again the Role Expire fields to the view?
Comment #7
nchristensen commented@rcondina I have. I also attempted recreating from a fresh view and encountered the same error. I haven't tried disabling and enabling the module, but since we have so many users with role expirations already, Im afraid to do so and risk losing data or causing database errors.
Comment #8
nchristensen commentedFor prosperity I disabled and re-enabled the module on a dev version. This did not fix the issue, unfortunately.
Comment #9
rcodinaI'll check this problem when I have time.
Comment #10
rcodinaComment #11
rcodinaSorry, but I can't reproduce the error. Could you update to Drupal 9 and test if the problem is solved?
Comment #12
rcodinaComment #13
nguerrier commentedThere were several errors in role_expire.views.inc, the sort & filters handlers were pointing to not existing handlers.
Attached patch fixes that.
Comment #14
nguerrier commentedComment #15
andypostComment #16
rcodinaFinally, I reproduced the error. It's my fault for not reading "as filter" in the title. Initially, filter and sort plugins were not taken into account when I developed the views integration of this module. However, at that moment, I defined the "sort" and "filter" values in the associative array and later I forgot to test sorting and filtering (I only needed to display expire data as fields).
In fact, what needs to be done here is to develop two custom filter plugins and two custom sort plugins given that "Role expire" information is stored in a custom database. Therefore, in this issue seems to be a lot of work to do. For this reasons, after patch on #13, filter may seem to work in some situations (but it's not) and sorting it's not working at all.
Comment #17
_tarik_ commentedI did some issue testing, so here is what I’ve found:
The problem, as @nguerrier mentioned in comment #13, comes from the missing filter and sorting plugins.
We can safely use the default date plugin from the views module to sort records, but the problem appears with the filter plugin.
The default date filter plugin from the Views module is useful for working with relative dates, but with the absolute ones, it doesn’t seem fine. Example:
1. A user with the role test_role has an expiration timestamp of 1758544121, which corresponds to 22 September 2025, 12:28:41.
2. A site administrator creates a view to show users with the test_role role expiring on 2025-09-22.
3. The view returns no results because the database query uses the = operator. The timestamp for 2025-09-22 is 1758499200, which does not equal 1758544121
I recommend continuing to use the default date plugin for sorting, since it works as expected. For filtering, however, we should implement custom plugins: one designed for relative dates and another for absolute dates.
Comment #18
_tarik_ commentedComment #20
_tarik_ commentedI’ve started work on this issue, but found that we can probably avoid providing any additional code. It seems we can delegate work with dates to the date_filter module.
If we do so, then in the scope of this issue, there are only 2 tasks:
1. Update the README and describe the recommended way to work with the dates with the date_filter module.
2. Provide unit tests.
@rcodina, please let me know what you think. Do we need to provide our own solution or use a solution from Drupal? I believe we don’t need to extend the code base if we can use other modules that fit our requirements.
PS. The current MR contains changes from comment #13. It works as a charm, thanks to @nguerrier.
Comment #21
_tarik_ commented