My solution is working. You can see below code fragment from member.php and see it:
//-----------------------------------------------------
//---Show Member Comments------------------------------
//-----------------------------------------------------
if ($action == "showcomments") {
if (isset($HTTP_GET_VARS[URL_USER_ID]) || isset($HTTP_POST_VARS[URL_USER_ID])) {
$user_id = (isset($HTTP_GET_VARS[URL_USER_ID])) ? intval($HTTP_GET_VARS[URL_USER_ID]) : intval($HTTP_POST_VARS[URL_USER_ID]);
if (!$user_id) {
$num_comments = "";
$user_id = GUEST;
}
if (isset($HTTP_POST_VARS['commentsetperpage']) || isset($HTTP_GET_VARS['commentsetperpage'])) {
$commentsetperpage = (intval($HTTP_POST_VARS['commentsetperpage']) ) ? intval($HTTP_POST_VARS['commentsetperpage']) : intval($HTTP_GET_VARS['commentsetperpage']);
if ($commentsetperpage) {
$site_sess->set_session_var("commentperpage", $commentsetperpage);
$session_info['commentperpage'] = $commentsetperpage;
}
}
if (isset($session_info['commentperpage'])) {
$commentperpage = $session_info['commentperpage'];
}
else {
$commentperpage = 5;
}
$commentsperpage_dropdown = "\n<select name=\"commentsetperpage\" onchange=\"if (this.options[this.selectedIndex].value != 0){ forms['commentsperpage'].submit() }\" class=\"select\">\n";
for($i = 1; $i <= 4; $i++) {
$setvalue = 5 * $i;
$commentsperpage_dropdown .= "<option value=\"".$setvalue."\"";
if ($setvalue == $commentperpage) {
$commentsperpage_dropdown .= " selected=\"selected\"";
}
$commentsperpage_dropdown .= ">";
$commentsperpage_dropdown .= $setvalue;
$commentsperpage_dropdown .= "</option>\n";
}
$commentsperpage_dropdown .= "</select>\n";
$site_template->register_vars("commentsperpage_dropdown", $commentsperpage_dropdown);
$site_template->register_vars("lang_comments_per_page", $lang['comments_per_page']);
$commentsperpage_dropdown_form = $site_template->parse_template("commentsperpage_dropdown_form");
$site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);
$sql = "SELECT COUNT(user_id) AS comments
FROM ".COMMENTS_TABLE."
WHERE user_id = ".$user_id;
$result = $site_db->query_firstrow($sql);
$num_comments = $result['comments'];
$site_db->free_result();
$num_rows_all = (isset($num_comments)) ? $num_comments : 0;
$link_arg = $site_sess->url(ROOT_PATH."last.php?show");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
$offset = $getpaging->get_offset();
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => ($num_rows_all > $commentperpage) ? $getpaging->get_paging_stats() : ""
));
$additional_sql = "";
$table_fields = $site_db->get_table_fields(USERS_TABLE);
foreach ($additional_user_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
$additional_sql .= ", $key = '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
}
}
$sql = "SELECT c.comment_id, c.image_id, c.user_id, c.user_name AS comment_user_name, c.comment_headline, c.comment_text, c.comment_ip, c.comment_date".get_user_table_field(", u.", "user_level").get_user_table_field(", u.", "user_name").get_user_table_field(", u.", "user_email").get_user_table_field(", u.", "user_showemail").get_user_table_field(", u.", "user_invisible").get_user_table_field(", u.", "user_joindate").get_user_table_field(", u.", "user_lastaction").get_user_table_field(", u.", "user_comments").get_user_table_field(", u.", "user_homepage").get_user_table_field(", u.", "user_icq").$additional_sql."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE c.user_id = $user_id
ORDER BY c.comment_date DESC, c.image_id ASC
LIMIT $offset, $commentperpage";
$result = $site_db->query($sql);
$comment_row = array();
while ($row = $site_db->fetch_array($result)) {
$comment_row[] = $row;
}
$site_db->free_result($result);
$num_comments = sizeof($comment_row);
}
else {
$num_comments = "";
}
if (!$num_comments) {
$content = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"4\" class=\"bordercolor\"><tr><td class=\"commentrow1\">".$lang['member_no_comments']."</td></tr></table>";
}
else {
$content = "";
for ($i = 0; $i < $num_comments; $i++) {
$image_id = $comment_row[$i]['image_id'];
$sql = "SELECT i.image_id, i.cat_id, i.image_name, i.image_date, c.cat_name, i.image_media_file, i.image_thumb_file, i.image_allow_comments
FROM ".IMAGES_TABLE." i, ".CATEGORIES_TABLE." c
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = i.user_id)
WHERE i.image_id = $image_id AND c.cat_id = i.cat_id";
$image_row = $site_db->query_firstrow($sql);
$cat_id = (isset($image_row['cat_id'])) ? $image_row['cat_id'] : 0;
$image_allow_comments = (check_permission("auth_readcomment", $cat_id)) ? $image_row['image_allow_comments'] : 0;
if ($image_allow_comments == 1){
$same = ($current != $comment_row[$i]['image_id']) ? 1 : 0;
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_id = $comment_row[$i]['user_id'];
$user_row_comment = get_user_info($comment_user_id);
$comment_user_profile_link = "";
if (isset($comment_row[$i][$user_table_fields['user_name']]) && $comment_user_id != GUEST) {
$comment_user_name = htmlspecialchars($comment_row[$i][$user_table_fields['user_name']]);
$comment_user_profile_link = !empty($url_show_profile) ? $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_show_profile)) : $site_sess->url(ROOT_PATH."member.php?action=showprofile&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_profile_link = ($comment_user_profile_link) ? "<a href=\"".$comment_user_profile_link."\">".$comment_user_name."</a>" : $comment_user_name;
if (!get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 0)) {
$thumb_file = ICON_PATH."/".get_file_extension($image_row['image_media_file']).".gif";
}else {
$thumb_file = get_file_path($image_row['image_thumb_file'], "thumb", $image_row['cat_id'], 0, 1);
}
$thumb_info = @getimagesize($thumb_file);
$width = $thumb_info[0];
$height = $thumb_info[1];
$dimension = 80;
$ratio = $width / $height;
if ($ratio > 1) {
$new_width = $dimension;
$new_height = floor(($dimension/$width) * $height);
}else {
$new_width = floor(($dimension/$height) * $width);
$new_height = $dimension;
}
$admin_links = "";
if ($user_info['user_level'] == ADMIN) {
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=editcomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a> ";
$admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['delete']."</a>";
}
elseif ($comment_user_id == $user_info['user_id'] && $user_info['user_level'] >= USER) {
$admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a> ";
$admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
}
$is_new = ($image_row['image_date'] >= (time() - 60 * 60 * 24 * $config['new_cutoff'])) ? 1 : 0;
$row_bg_number = ($row_bg_number == 2) ? 1 : 2;
$site_template->register_vars(array(
"comment_image_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "
<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">
<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" border=\"".$config['image_border']."\"></a>",
"comment_image_name" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? $image_row['image_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id'].((!empty($mode)) ? "&mode=".$mode : ""))."\">".$image_row['image_name']."</a>",
"comment_cat_name" => (!check_permission("auth_viewcat", $cat_id)) ? $image_row['cat_name'] : "<a href=\"".$site_sess->url(ROOT_PATH."categories.php?".URL_CAT_ID."=".$cat_id)."\">".$image_row['cat_name']."</a>",
"comment_user_name" => $comment_user_profile_link,
"comment_headline" => format_text($comment_row[$i]['comment_headline'], 0, $config['wordwrap_comments'], 0, 0),
"comment_text" => format_text($comment_row[$i]['comment_text'], $config['html_comments'], $config['wordwrap_comments'], $config['bb_comments'], $config['bb_img_comments']),
"comment_date" => format_date($config['date_format']." ".$config['time_format'], $comment_row[$i]['comment_date']),
"admin_links" => $admin_links,
"image_is_new" => $is_new,
"lang_new" => $lang['new'],
"row_bg_number" => $row_bg_number
));
$content .= $site_template->parse_template("member_comment_bit");
}
} // end while
} //end else
$txt_clickstream = $lang['member_comments']." ".$comment_user_name;
$txt_clickstream_nohtml = $txt_clickstream;
}
member_comment_bit.html:
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table cellpadding="1" cellspacing="0" border="0">
<tr><td rowspan=2 width="100" valign="top">
{comment_image_thumb}
</td><td colspan="3" width="656" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td valign="top"><b>{comment_image_name}</b>{if image_is_new} <SUP class=new>{lang_new}</SUP>{endif image_is_new}
| {comment_cat_name}</td>
<td valign="top" align="right">
{comment_date}
</td></tr></table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr><td bgcolor="#dddddd" colspan=2 height="1"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr>
<tr><td>
<b>{comment_headline}</b>
</td><td valign="top" align="right">
{if admin_links}{admin_links}{endif admin_links}{if user_loggedin} {comment_quote}{endif user_loggedin}
</td></tr>
<tr><td bgcolor="#dddddd" colspan=2 height="1"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td></tr></table>
<div class=vert2> </div>
{comment_text}
</td></tr>
</table></td></tr>
<tr><td><hr class="dotted"></td></tr>
</table>