mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -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'])) {
|
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)) {
|
if (!DB()->sql_query($sql)) {
|
||||||
bb_die('Could not insert ban_userid info into database');
|
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'])) {
|
if ($banInfo = getBanInfo((int)$profiledata['user_id'])) {
|
||||||
$template->assign_block_vars('ban', [
|
$template->assign_block_vars('ban', [
|
||||||
'IS_BANNED' => true,
|
'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="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>
|
<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>
|
||||||
|
<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>
|
<tr>
|
||||||
<th colspan="2">{L_UNBAN_USERNAME}</th>
|
<th colspan="2">{L_UNBAN_USERNAME}</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
|
@ -229,6 +229,16 @@ ajax.callback.group_membership = function(data) {
|
||||||
{RANK_IMAGE}
|
{RANK_IMAGE}
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
</p>
|
</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 -->
|
<!-- IF BIRTHDAY_ICON --><div class="mrg_8">{BIRTHDAY_ICON}</div><!-- ENDIF -->
|
||||||
<h4 class="cat border bw_TB">{L_CONTACT} {USERNAME}</span></h4>
|
<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>
|
<th>{L_USERNAME}:</th>
|
||||||
<td id="username">
|
<td id="username">
|
||||||
<span class="editable bold">{USERNAME}</span>
|
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<!-- IF SHOW_ROLE -->
|
<!-- IF SHOW_ROLE -->
|
||||||
|
|
|
@ -738,10 +738,7 @@ for ($i = 0; $i < $total_posts; $i++) {
|
||||||
|
|
||||||
// Ban information
|
// Ban information
|
||||||
if ($banInfo = getBanInfo((int)$poster_id)) {
|
if ($banInfo = getBanInfo((int)$poster_id)) {
|
||||||
$template->assign_block_vars('postrow.ban', [
|
$template->assign_block_vars('postrow.ban', ['IS_BANNED' => true]);
|
||||||
'IS_BANNED' => true,
|
|
||||||
'BAN_REASON' => $banInfo['ban_reason']
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($postrow[$i]['post_attachment']) && $is_auth['auth_download'] && function_exists('display_post_attachments')) {
|
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