diff options
Diffstat (limited to 'phpBB/includes/mcp/mcp_ban.php')
-rw-r--r-- | phpBB/includes/mcp/mcp_ban.php | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/phpBB/includes/mcp/mcp_ban.php b/phpBB/includes/mcp/mcp_ban.php index 510943aa45..5a7240143a 100644 --- a/phpBB/includes/mcp/mcp_ban.php +++ b/phpBB/includes/mcp/mcp_ban.php @@ -104,8 +104,41 @@ class mcp_ban 'U_ACTION' => $this->u_action, 'U_FIND_USER' => append_sid("{$phpbb_root_path}memberlist.$phpEx", 'mode=searchuser&form=mcp_ban&field=ban'), - ) - ); + )); + + if ($mode != 'user') + { + return; + } + + // As a "service" we will check if any post id is specified and populate the username of the poster id if given + $post_id = request_var('p', 0); + $user_id = request_var('u', 0); + $username = false; + + if ($user_id && $user_id <> ANONYMOUS) + { + $sql = 'SELECT username + FROM ' . USERS_TABLE . ' + WHERE user_id = ' . $user_id; + $result = $db->sql_query($sql); + $username = (string) $db->sql_fetchfield('username'); + $db->sql_freeresult($result); + } + else if ($post_id) + { + $post_info = get_post_data($post_id, 'm_ban'); + + if (sizeof($post_info) && !empty($post_info[$post_id])) + { + $username = $post_info[$post_id]['username']; + } + } + + if ($username) + { + $template->assign_var('USERNAMES', $username); + } } } |