[EDIT by V@no]This mod was made by rproctor. This is just a re-post of the lost original topic[/EDIT]
I was looking for this MOD for long time and finally found it somewhere in this forum again .. coz i took it from here before
I'll copy the file that was attached to a V@no's poste somewhere don't got the link now .. but have the file that V@no attached , here are the contents:
Here is a mod that allows users to see how many comments they have recieved, with the ability to browse through them all at once, and additionaly be able to remove comments from their comment list, however, it will not remove them from the image.
Demo:
www.digitalgod.biz/test username: demo
password: beef
Once logged in, in the logininfo box under logout, you can see the mods effect.
-----------------------------------------------
Database entries:
1 new field
Edited Files:
member.php
page_header.php
user_logininfo.html
New templates:
member_comment_bit.html
member_comments.html
member_commentsdropdown_form.html
----------------------------------------------
Step 1) First you will need to insert a new field into the COMMENTS_TABLE using a program like PHPMyAdmin or another database management program. This field should be the following
name: is_read
type: tinyint(1)
null: no
default: 0
Step 2) Once you have completed step 1, open 4images/includes/
page_header.php and find:
$site_template->register_vars(array(
"media_url" => MEDIA_PATH,
Add Before:
$sql = "SELECT c.comment_id
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
WHERE i.user_id = ".$user_info['user_id']." AND c.is_read = 0";
$result = $site_db->query($sql);
$new_comments = $site_db->get_numrows($result);
Step 2.1) In the same file find a few lines below:
"url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),
Add Before:
"new_comments" => $new_comments,
"url_comments" => $site_sess->url(ROOT_PATH."member.php?action=readcomments"),
Step 3) Open 4images/
member.php and find:
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
Add Before:
if ($action == "readcomments") {
if ($user_info['user_level'] == GUEST) {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
$txt_clickstream = "Comments";
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 <= 15; $i++) {
$setvalue = 1 * $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);
$commentsperpage_dropdown_form = $site_template->parse_template("member_commentsdropdown_form");
$site_template->register_vars("commentsperpage_dropdown_form", $commentsperpage_dropdown_form);
$sql = "SELECT COUNT(c.comment_id) AS comments
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
WHERE i.user_id = ".$user_info['user_id']." AND c.is_read = 0";
$result = $site_db->query_firstrow($sql);
$site_db->free_result();
$num_comments = $result['comments'];
if ($action == "postcomment") {
$page = ceil($num_comments / $commentperpage);
}
$num_rows_all = (isset($num_comments)) ? $num_comments : 0;
$link_arg = $site_sess->url(ROOT_PATH."member.php?action=readcomments");
include(ROOT_PATH.'includes/paging.php');
$getpaging = new Paging($page, $commentperpage, $num_rows_all, $link_arg, $lang['comment_stats'], "comments");
$offset = $getpaging->get_offset();
$get_comment_stats = ($num_comments) ? $getpaging->get_paging_stats() : "";
$comment_stats = preg_replace("/image/", "comment", $get_comment_stats);
$site_template->register_vars(array(
"paging" => $getpaging->get_paging(),
"paging_stats" => $comment_stats
));
$additional_sql = "";
if (!empty($additional_user_fields)) {
$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, i.image_name".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")."
FROM ".COMMENTS_TABLE." c
LEFT JOIN ".IMAGES_TABLE." i ON i.image_id = c.image_id
LEFT JOIN ".USERS_TABLE." u ON (".get_user_table_field("u.", "user_id")." = c.user_id)
WHERE i.user_id = ".$user_info['user_id']." AND c.is_read = 0
ORDER BY c.comment_date 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);
if (!$num_comments) {
$comments = "<tr><td class=\"commentrow1\" colspan=\"2\"> There currently are no comments. </td></tr>";
}
else {
$comments = "";
$bgcounter = 0;
for ($i = 0; $i < $num_comments; $i++) {
$row_bg_number = ($bgcounter++ % 2 == 0) ? 1 : 2;
$comment_user_email = "";
$comment_user_email_save = "";
$comment_user_mailform_link = "";
$comment_user_email_button = "";
$comment_user_homepage_button = "";
$comment_user_icq_button = "";
$comment_user_profile_button = "";
$comment_user_status_img = REPLACE_EMPTY;
$comment_user_name = htmlspecialchars($comment_row[$i]['comment_user_name']);
$comment_user_info = $lang['userlevel_guest'];
$comment_user_id = $comment_row[$i]['user_id'];
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_button = "<a href=\"".$comment_user_profile_link."\"><img src=\"".get_gallery_image("profile.gif")."\" border=\"0\" alt=\"".$comment_user_name."\" /></a>";
$comment_user_status_img = ($comment_row[$i][$user_table_fields['user_lastaction']] >= (time() - 300) && ((isset($comment_row[$i][$user_table_fields['user_invisible']]) && $comment_row[$i][$user_table_fields['user_invisible']] == 0) || $user_info['user_level'] == ADMIN)) ? "<img src=\"".get_gallery_image("user_online.gif")."\" border=\"0\" alt=\"Online\" />" : "<img src=\"".get_gallery_image("user_offline.gif")."\" border=\"0\" alt=\"Offline\" />";
$comment_user_homepage = (isset($comment_row[$i][$user_table_fields['user_homepage']])) ? format_url($comment_row[$i][$user_table_fields['user_homepage']]) : "";
if (!empty($comment_user_homepage)) {
$comment_user_homepage_button = "<a href=\"".$comment_user_homepage."\" target=\"_blank\"><img src=\"".get_gallery_image("homepage.gif")."\" border=\"0\" alt=\"".$comment_user_homepage."\" /></a>";
}
$comment_user_icq = (isset($comment_row[$i][$user_table_fields['user_icq']])) ? $comment_row[$i][$user_table_fields['user_icq']] : "";
if (!empty($comment_user_icq)) {
$comment_user_icq_button = "<a href=\"http://wwp.icq.com/scripts/search.dll?to=".$comment_user_icq."\" target=\"_blank\"><img src=\"http://web.icq.com/whitepages/online?icq=".$comment_user_icq."&img=5\" width=\"18\" height=\"18\" border=\"0\" alt=\"".$comment_user_icq."\" /></a>";
}
if (!empty($comment_row[$i][$user_table_fields['user_email']]) && (!isset($comment_row[$i][$user_table_fields['user_showemail']]) || (isset($comment_row[$i][$user_table_fields['user_showemail']]) && $comment_row[$i][$user_table_fields['user_showemail']] == 1))) {
$comment_user_email = $comment_row[$i][$user_table_fields['user_email']];
$comment_user_email_save = str_replace("@", " at ", $comment_row[$i][$user_table_fields['user_email']]);
if (!empty($url_mailform)) {
$comment_user_mailform_link = $site_sess->url(preg_replace("/{user_id}/", $comment_user_id, $url_mailform));
}
else {
$comment_user_mailform_link = $site_sess->url(ROOT_PATH."member.php?action=mailform&".URL_USER_ID."=".$comment_user_id);
}
$comment_user_email_button = "<a href=\"".$comment_user_mailform_link."\"><img src=\"".get_gallery_image("email.gif")."\" border=\"0\" alt=\"".$comment_user_email_save."\" /></a>";
}
if (!isset($comment_row[$i][$user_table_fields['user_level']]) || (isset($comment_row[$i][$user_table_fields['user_level']]) && $comment_row[$i][$user_table_fields['user_level']] == USER)) {
$comment_user_info = $lang['userlevel_user'];
}
elseif ($comment_row[$i][$user_table_fields['user_level']] == ADMIN) {
$comment_user_info = $lang['userlevel_admin'];
}
$comment_user_info .= "<br />";
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_joindate']])) ? "<br />".$lang['join_date']." ".format_date($config['date_format'], $comment_row[$i][$user_table_fields['user_joindate']]) : "";
$comment_user_info .= (isset($comment_row[$i][$user_table_fields['user_comments']])) ? "<br />".$lang['comments']." ".$comment_row[$i][$user_table_fields['user_comments']] : "";
}
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
$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 ($is_image_owner) {
$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>";
}
$image_url = $site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$comment_row[$i]['image_id']);
$image_link = "<b><a href=\"".$image_url."\">".$comment_row[$i]['image_name']."</a></b>";
$site_template->register_vars(array(
"count" => $i,
"image_name" => $image_link,
"comment_id" => $comment_row[$i]['comment_id'],
"comment_user_id" => $comment_user_id,
"comment_user_status_img" => $comment_user_status_img,
"comment_user_name" => $comment_user_name,
"comment_user_info" => $comment_user_info,
"comment_user_profile_button" => $comment_user_profile_button,
"comment_user_email" => $comment_user_email,
"comment_user_email_save" => $comment_user_email_save,
"comment_user_mailform_link" => $comment_user_mailform_link,
"comment_user_email_button" => $comment_user_email_button,
"comment_user_homepage_button" => $comment_user_homepage_button,
"comment_user_icq_button" => $comment_user_icq_button,
"comment_user_ip" => $comment_user_ip,
"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']),
"row_bg_number" => $row_bg_number,
"admin_links" => $admin_links
));
$comments .= $site_template->parse_template("member_comment_bit");
} // end while
} //end else
$site_template->register_vars("comments", $comments);
unset($comments);
$content = $site_template->parse_template("member_comments");
}
if ($action == "removecomments") {
if ($user_info['user_level'] == GUEST) {
header("Location: ".$site_sess->url($url, "&"));
exit;
}
$remove_id = ($HTTP_POST_VARS['remove_id']) ? $HTTP_POST_VARS['remove_id'] : $HTTP_GET_VARS['remove_id'];
if($remove_id){
foreach ($remove_id as $key => $remove_id) {
$sql = "UPDATE ".COMMENTS_TABLE."
SET is_read = 1
WHERE comment_id = $remove_id";
$site_db->query($sql);
}
}
$member_comments_url = $site_sess->url(ROOT_PATH."member.php?action=readcomments");
$member_comments = "<b><a href=\"".$member_comments_url."\">Here</a></b>";
$content = "<meta http-equiv=\"refresh\" content=\"1; url=".$site_sess->url(ROOT_PATH."member.php?action=readcomments\"><div align=\"center\"> <b>Comments removed from list.</b> <br> If you are not automatically returned please click ".$member_comments."");
}
Step 4) Create a new file called
member_comment_bit.html and add this to it:
<tr>
<td class="commentrow{row_bg_number}" nowrap="nowrap"> <strong>{image_name}</strong></td>
<td class="commentrow{row_bg_number}" nowrap="nowrap"><div align="right">Mark
as read:
<input type="checkbox" name="remove_id[{count}]" value="{comment_id}">
</div></td>
</tr>
<tr>
<td class="commentrow{row_bg_number}" valign="top" nowrap="nowrap"> <b>{comment_user_name}</b><br />
{comment_user_info} {if comment_user_ip}<br /> <br /> <b>IP:</b> {comment_user_ip}{endif
comment_user_ip} </td>
<td width="100%" class="commentrow{row_bg_number}" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"><b>{comment_headline}</b></td>
<td valign="top" align="right">{if admin_links}{admin_links}{endif admin_links}</td>
</tr>
</table>
<hr size="1" />
{comment_text} </td>
</tr>
<tr>
<td class="commentrow{row_bg_number}" nowrap="nowrap"> <span class="smalltext">{comment_date}</span>
</td>
<td class="commentrow{row_bg_number}"> {comment_user_status_img} {comment_user_profile_button}
{comment_user_email_button} {comment_user_homepage_button} {comment_user_icq_button}
</td>
</tr>
<tr>
<td colspan="2" class="commentspacerrow"><img src="{template_url}/images/spacer.gif" width="1" height="1" alt="" /></td>
</tr>
Step 4.1) Create a new file called
member_comments.html and add this to it:
<script language="JavaScript">
<!--
function CheckAll(check) {
for (var i=0;i<document.form.elements.length;i++) {
var e = document.form.elements[i];
if ((e.name != 'allbox') && (e.type=='checkbox')) {
e.checked = (check) ? true : document.form.allbox.checked;
}
}
}
// -->
</script>
<a name="comments"></a> {if paging_stats}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor">
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="row1" valign="middle"> {paging_stats} </td>
<td class="row1" valign="top" align="right"> {commentsperpage_dropdown_form}
</td>
</tr>
</table></td>
</tr>
</table>
<br />
{endif paging_stats} {if paging}
<table width="100%" border="0" cellspacing="1" cellpadding="0" class="bordercolor">
<tr>
<td> <table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td class="row1" valign="top">{paging}</td>
<td class="row1" valign="top"> </td>
</tr>
</table></td>
</tr>
</table>
<br />
{endif paging}
<form name="form" action="{self}" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td class="head1" valign="top"> <table width="100%" border="0" cellpadding="3" cellspacing="1">
<tr>
<td valign="top" class="head1">Image & Author</td>
<td valign="top" class="head1">Comment</td>
</tr>
{comments} </table></td>
</tr>
</table>
<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%"> <input type="hidden" name="action" value="removecomments" />
<input type="submit" name="Submit" value="Remove Selected" /> </td>
<td width="50%"> <div align="right">Check All:
<input name="allbox" type="checkbox" onClick="CheckAll();" style="height: 13px; width: 13px;" />
</div></td>
</tr>
</table>
</form>
Step 4.2) Create a new file called
member_commentsdropdown_form.html and add this to it:
<table border="0" cellspacing="0" cellpadding="0">
<form method="post" action="{self}?action=readcomments#comments" name="commentsperpage">
<tr>
<td>Comments per page: </td>
<td>{commentsperpage_dropdown}</td>
</tr>
</form>
</table>
Step 5) Open 4images/templates/<your_template>/
user_logininfo.html and add this line of code where you want it to appear
» <a href="{url_comments}">Comments ({new_comments})</a></td>
Step 6) First backup all edited files, then upload the edited files to your website. Add the new html templates to your template folder, 4images/templates/<your_template>/ and that should be about it.
Note: There are no lang files included, if you wish to change the few instances of text, simply find them within the code, they are all unique, should be easy to spot
Note: Comments per page drop down only works if you are viewing the first page of comments. Dont know how to make it work any other way. Paging supplied by vanos mod.
Note: For those of you who installed the previous show comment mod that relies on the PMS you should remove it, and upgrade to this, unless you have your reasons. The previous mod had some problems, and wasnt very user friendly. This however, is much better.
the file that was attached is
http://www.emarati.net/ShowReceivedComments.htmand it was requested as I found here :
http://www.4homepages.de/forum/index.php?topic=10295.0http://www.4homepages.de/forum/index.php?topic=4808.0http://www.4homepages.de/forum/index.php?topic=8725.0enjoy !