mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 22:03:49 -07:00
feat: Allow setting custom ban reason when banning users (#2094)
* feat: Allow setting custom ban reason when banning users * Updated * Update usercp_viewprofile.tpl * Update usercp_viewprofile.tpl
This commit is contained in:
parent
af9bf7382c
commit
16e28a5c41
5 changed files with 21 additions and 9 deletions
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -83,7 +83,7 @@ if ($bb_cfg['ratio_null_enabled'] && $btu = get_bt_userdata($profiledata['user_i
|
|||
if ($banInfo = getBanInfo((int)$profiledata['user_id'])) {
|
||||
$template->assign_block_vars('ban', [
|
||||
'IS_BANNED' => true,
|
||||
'BAN_REASON' => $banInfo['ban_reason']
|
||||
'BAN_REASON' => IS_ADMIN ? $banInfo['ban_reason'] : '',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -229,6 +229,16 @@ ajax.callback.group_membership = function(data) {
|
|||
{RANK_IMAGE}
|
||||
<!-- ENDIF -->
|
||||
</p>
|
||||
<!-- BEGIN ban -->
|
||||
<hr/>
|
||||
<!-- IF ban.IS_BANNED -->
|
||||
<b title="{L_BANNED_USERS}" class="warnColor2">{L_BANNED}</b>
|
||||
<!-- ENDIF -->
|
||||
<!-- IF ban.BAN_REASON -->
|
||||
<div class="mrg_4">{L_REASON}: {ban.BAN_REASON}</div>
|
||||
<!-- ENDIF -->
|
||||
<hr/>
|
||||
<!-- END ban -->
|
||||
<!-- IF BIRTHDAY_ICON --><div class="mrg_8">{BIRTHDAY_ICON}</div><!-- ENDIF -->
|
||||
<h4 class="cat border bw_TB">{L_CONTACT} {USERNAME}</span></h4>
|
||||
|
||||
|
@ -300,9 +310,6 @@ ajax.callback.group_membership = function(data) {
|
|||
<th>{L_USERNAME}:</th>
|
||||
<td id="username">
|
||||
<span class="editable bold">{USERNAME}</span>
|
||||
<!-- BEGIN ban -->
|
||||
<!-- IF ban.IS_BANNED -->(<b title="{L_BANNED_USERS}" style="color: red;">{L_BANNED}</b>)<!-- ENDIF -->
|
||||
<!-- END ban -->
|
||||
</td>
|
||||
</tr>
|
||||
<!-- IF SHOW_ROLE -->
|
||||
|
|
|
@ -738,10 +738,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
|||
|
||||
// Ban information
|
||||
if ($banInfo = getBanInfo((int)$poster_id)) {
|
||||
$template->assign_block_vars('postrow.ban', [
|
||||
'IS_BANNED' => true,
|
||||
'BAN_REASON' => $banInfo['ban_reason']
|
||||
]);
|
||||
$template->assign_block_vars('postrow.ban', ['IS_BANNED' => true]);
|
||||
}
|
||||
|
||||
if (isset($postrow[$i]['post_attachment']) && $is_auth['auth_download'] && function_exists('display_post_attachments')) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue