Thank you for the detailed response.
Look please my replacements and additions in it MODs and you will understand.
It works on our forum. Just has tested.
Code: Select all
##################################################
## MOD Title: Admin Userlist 2.0.5c Fixing and additions
## MOD Author: Porutchik < garnitur356 [at] mail15.com > (Sergey) http://forum.aeroion.ru
## MOD Description: This MOD adds possibility of deleting (unban) of the user from banlist.
##
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ~10 Minutes
## Files To Edit: (3)
## admin/admin_userlist.php
## language/lang_english/lang_admin.php
## templates/subSilver/admin/userlist_body.tpl
##
## Included Files: N/A
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##################################################
## Author Notes:
##
## You must have version Admin Userlist 2.0.5c by Milkboy31 installed in order for this MOD to work.
## http://www.phpbb.com/phpBB/viewtopic.php?t=117359
##
##################################################
## MOD History:
##
## 2006-01-19 - Version 1.0.0
## - Initial Release
##################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##################################################
#
#-----[ OPEN ]---------------------------------------------
#
admin/admin_userlist.php
#
#-----[ FIND ]---------------------------------------------
#
message_die(GENERAL_ERROR, 'Could not obtain ban user', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]---------------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete sessions for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_KEYS_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete auto-login keys for this user', '', __LINE__, __FILE__, $sql);
}
#
#-----[ FIND ]---------------------------------------------
#
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
}
#
#-----[ AFTER, ADD ]---------------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete sessions for this user', '', __LINE__, __FILE__, $sql);
}
$sql = "DELETE FROM " . SESSIONS_KEYS_TABLE . "
WHERE user_id = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete auto-login keys for this user', '', __LINE__, __FILE__, $sql);
}
#
#-----[ FIND ]---------------------------------------------
#
$message = $lang['User_banned_successfully'] . "<br /><br />" . sprintf($lang['Click_return_userlist'], "<a href=\"" . append_sid("admin_userlist.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
break;
#
#-----[ AFTER, ADD ]---------------------------------------
#
case 'unban':
//
// see if cancel has been hit and redirect if it has
// shouldn't get to this point if it has been hit but
// do this just in case
//
if ( $cancel )
{
redirect($phpbb_root_path . 'admin/admin_userlist.'.$phpEx);
}
//
// check confirm and either ban or show confirm message
//
if ( !$confirm )
{
$i = 0;
$hidden_fields = '';
while( $i < count($user_ids) )
{
$user_id = intval($user_ids[$i]);
$hidden_fields .= '<input type="hidden" name="' . POST_USERS_URL . '[]" value="' . $user_id . '">';
unset($user_id);
$i++;
}
$template->set_filenames(array(
'body' => 'confirm_body.tpl')
);
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['UnBan'],
'MESSAGE_TEXT' => $lang['Confirm_user_un_ban'],
'U_INDEX' => '',
'L_INDEX' => '',
'L_YES' => $lang['Yes'],
'L_NO' => $lang['No'],
'S_CONFIRM_ACTION' => append_sid('admin_userlist.'.$phpEx.'?mode=unban'),
'S_HIDDEN_FIELDS' => $hidden_fields)
);
}
else
{
// unban users
$i = 0;
while( $i < count($user_ids) )
{
$user_id = intval($user_ids[$i]);
$sql = "DELETE FROM " . BANLIST_TABLE . "
WHERE ban_userid = $user_id";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not delete user from banlist table', '', __LINE__, __FILE__, $sql);
}
unset($user_id);
$i++;
}
$message = $lang['User_un_banned_successfully'] . "<br /><br />" . sprintf($lang['Click_return_userlist'], "<a href=\"" . append_sid("admin_userlist.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
message_die(GENERAL_MESSAGE, $message);
}
break;
#
#-----[ FIND ]---------------------------------------------
#
'L_BAN' => $lang['Ban'],
#
#-----[ AFTER, ADD ]---------------------------------------
#
'L_UNBAN' => $lang['UnBan'],
#
#-----[ FIND ]---------------------------------------------
#
'S_HIDDEN_FIELDS' => $hidden_fields)
);
$order_by = "ORDER BY $sort $sort_order ";
#
#-----[ AFTER, ADD ]---------------------------------------
#
// Get ban data
//
$sql = 'SELECT ban_userid
FROM ' . BANLIST_TABLE;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain banlist information", "", __LINE__, __FILE__, $sql);
}
while ( $row = $db->sql_fetchrow($result) )
{
$banned[$row['ban_userid']] = true;
}
$db->sql_freeresult($result);
//
// users rank
//
$rank_sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
if ( !($rank_result = $db->sql_query($rank_sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
}
while ( $rank_row = $db->sql_fetchrow($rank_result) )
{
$ranksrow[] = $rank_row;
}
$db->sql_freeresult($rank_result);
#
#-----[ FIND ]---------------------------------------------
#
//
// users rank
//
$rank_sql = "SELECT *
FROM " . RANKS_TABLE . "
ORDER BY rank_special, rank_min";
if ( !($rank_result = $db->sql_query($rank_sql)) )
{
message_die(GENERAL_ERROR, 'Could not obtain ranks information', '', __LINE__, __FILE__, $sql);
}
while ( $rank_row = $db->sql_fetchrow($rank_result) )
{
$ranksrow[] = $rank_row;
}
$db->sql_freeresult($rank_result);
#
#-----[ REPLACE WITH ]---------------------------------------------
# Remove these lines (actually move them elsewhere)
#
#
#-----[ FIND ]---------------------------------------------
#
'USERNAME' => $row['username'],
#
#-----[ REPLACE WITH ]---------------------------------------------
#
'USERNAME' => ( ($banned[$row['user_id']]) ? '<b>'. $lang['Is_Banned'] .'</b> ': '' ) . $row['username'],
#
#-----[ OPEN ]---------------------------------------------
#
language/lang_english/lang_admin.php
#
#-----[ FIND ]---------------------------------------------
#
$lang['Ban'] = 'Ban';
#
#-----[ AFTER, ADD ]---------------------------------------
#
$lang['Is_Banned'] = 'banned!';
$lang['UnBan'] = 'Un-ban';
#
#-----[ FIND ]---------------------------------------------
#
$lang['Confirm_user_ban'] = 'Are you sure you want to ban the selected user(s)?';
#
#-----[ AFTER, ADD ]---------------------------------------
#
$lang['Confirm_user_un_ban'] = 'Are you sure you want to unban the selected user(s)?';
#
#-----[ FIND ]---------------------------------------------
#
$lang['User_banned_successfully'] = 'User(s) banned successfully!';
#
#-----[ AFTER, ADD ]---------------------------------------
#
$lang['User_un_banned_successfully'] = 'User(s) unbanned successfully!';
#
#-----[ OPEN ]---------------------------------------------
#
templates/subSilver/admin/userlist_body.tpl
#
#-----[ FIND ]---------------------------------------------
#
<option value="ban">{L_BAN}</option>
#
#-----[ AFTER, ADD ]---------------------------------------------
#
<option value="unban">{L_UNBAN}</option>
#
#-----[ SAVE/CLOSE ALL FILES ]----------------------------
#
# EoM