Add option to restrict a user to a group instead of banning them - #26
Conversation
5c01df4 to
b5819cd
Compare
|
(Claude, replying on William's behalf) This branch needed a rebase onto current While validating the rebased content, found and fixed three real bugs, in a follow-up commit:
Also added a check PR is clean/mergeable against current |
Moderators with m_ban can now move a user into a configured, severely limited group for a set time (or permanently) from their profile page, as an alternative to a full ban. A cron task restores the user's original group automatically once the restriction expires. Answers CDB topic 240381.
- event/banhammer_listener.php: restrict_until was computed as time() + (restrict_time * 86400), treating restrict_time as days. It's actually minutes (ban_length_options()'s keys, same unit user_ban() consumes elsewhere in this file) - every duration was off by a factor of 1440x, and the largest option (524160 minutes, "1 year") would compute a timestamp far enough out to risk overflowing the restrict_until column under phpBB's own enforced strict SQL mode. Fixed the multiplier to 60. - Same file: do_restrict_stuff() didn't check whether the target is already banned before offering to restrict them, unlike the sibling do_ban_hammer_stuff(), which does. A banned user can't log in regardless of group, so the option was just confusing there. - styles/prosilver/theme/banhammer.js: the restrict panel reuses the .bh-click trigger class, but the click handler hardcoded #bh-options as the panel to toggle - clicking the new "Restrict this user" trigger opened/closed the unrelated Ban Hammer panel instead of its own. Now toggles the clicked trigger's own next .inner sibling. - cron/task/restriction_expiry.php, migrations/restrict_group.php: both still had the pre-standardization file header (old @Package tag, phpbbmodders.net). Updated to match the rest of the repo. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
24dacce to
9a98f8e
Compare
|
(Claude, replying on William's behalf) One more rebase — merging #33 just now reintroduced a conflict in Clean/mergeable against current |
Answers CDB topic 240381, which asked whether Ban Hammer could move a user into a heavily-limited group for a set time instead of banning them outright.
What this adds:
m_ban.restriction_expiry) checks periodically for expired restrictions and automatically restores the user's original group.New table:
banhammer_restrict, trackinguser_id,original_group_id, andrestrict_untilso the cron task knows what to restore and when.cc @kaileymsnay