Inactive Users: REPORT mode creates permanent inactive flag#106
Merged
rinatkhaziev merged 6 commits intoMar 4, 2026
Merged
Conversation
…mode-permanent-flag
andrea-sdl
reviewed
Mar 3, 2026
Comment on lines
+148
to
+154
| if ( self::is_block_action_enabled() ) { | ||
| // User needs to be unblocked first. | ||
| return; | ||
| } | ||
|
|
||
| // In REPORT mode, clear the stale last seen meta so the user starts fresh. | ||
| delete_user_meta( $user_id, self::LAST_SEEN_META_KEY ); |
Contributor
There was a problem hiding this comment.
@katag9k what do we gain by cleaning this before it gets set again below? Wouldn't the update_user_meta be enough?
Contributor
Author
There was a problem hiding this comment.
Good point. I think I may have misinterpreted what @rinatkhaziev was suggesting. This whole thing hooks into set_current_user, so clearing the meta is pointless since it gets set again right after during the login process.
andrea-sdl
reviewed
Mar 3, 2026
andrea-sdl
left a comment
Contributor
There was a problem hiding this comment.
Thank you so much for this!!! I left a small comment to better understand if I'm missing a piece of the puzzle :)
andrea-sdl
approved these changes
Mar 3, 2026
rinatkhaziev
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
In the Inactive Users module, when the mode is set to
REPORT(flag only), users flagged as inactive can never have their status cleared through normal login activity.The
record_activity()method unconditionally skips recording activity for users already considered inactive, but the "Unblock" UI that provides the only way to clear the flag is only available inBLOCKmode. This creates a permanent "Inactive User" badge with no built-in resolution path inREPORTmode.The fix gates the early return in
record_activity()onBLOCKmode only, so that inREPORTmode logging in naturally records activity and clears the inactive flag.Changelog Description
Fixed
last_seenmeta was never cleared on loginPre-review checklist
Please make sure the items below have been covered before requesting a review:
Pre-deploy checklist
Steps to Test
last_seenmeta is older than the inactivity threshold).last_seenmeta is cleared on login and the user is no longer flagged as inactive.phpunit --filter test-inactive-usersand verify all tests pass.