feat: Allow setting custom ban reason when banning users

This commit is contained in:
Roman Kelesidis 2025-08-20 12:59:54 +03:00
commit 0c15aaec17
No known key found for this signature in database
GPG key ID: D8157C4D4C4C6DB4
2 changed files with 9 additions and 1 deletions

View file

@ -29,7 +29,11 @@ if ($submit) {
}
if (!getBanInfo((int)$this_userdata['user_id'])) {
$sql = 'INSERT INTO ' . BB_BANLIST . ' (ban_userid) VALUES (' . $this_userdata['user_id'] . ')';
$ban_reason = '';
if (!empty($_POST['ban_reason'])) {
$ban_reason = trim($_POST['ban_reason']);
}
$sql = 'INSERT INTO ' . BB_BANLIST . ' (ban_userid, ban_reason) VALUES (' . $this_userdata['user_id'] . ', "' . DB()->escape($ban_reason) . '")';
if (!DB()->sql_query($sql)) {
bb_die('Could not insert ban_userid info into database');
}

View file

@ -13,6 +13,10 @@
<td class="row1">{L_USERNAME}:</td>
<td class="row2"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" />{S_HIDDEN_FIELDS} <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_bbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
</tr>
<tr>
<td class="row1">{L_REASON}:</td>
<td class="row2"><input type="text" class="post" name="ban_reason" maxlength="255" size="80" /></td>
</tr>
<tr>
<th colspan="2">{L_UNBAN_USERNAME}</th>
</tr>