4images Forum & Community

4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Nasser on April 24, 2006, 02:01:18 PM

Title: [MOD] Show Received Comments V.2 (by rproctor)
Post by: Nasser on April 24, 2006, 02:01:18 PM
[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 (http://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:

:arrow: 1 new field

Edited Files:

:arrow: member.php
:arrow: page_header.php
:arrow: user_logininfo.html

New templates:

:arrow: member_comment_bit.html
:arrow: member_comments.html
:arrow: 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

Quote
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:

Code: [Select]
$site_template->register_vars(array(
  "media_url" => MEDIA_PATH,


Add Before:

Code: [Select]
$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:

Code: [Select]
  "url_new_images" => $site_sess->url(ROOT_PATH."search.php?search_new_images=1"),

Add Before:

Code: [Select]
  "new_comments" => $new_comments,
  "url_comments" => $site_sess->url(ROOT_PATH."member.php?action=readcomments"),


Step 3) Open 4images/member.php and find:

Code: [Select]
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------


Add Before:

Code: [Select]
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&amp;".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&amp;".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&amp;comment_id=".$comment_row[$i]['comment_id']))."\" target=\"_blank\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= "<a href=\"".$site_sess->url(ROOT_PATH."admin/index.php?goto=".urlencode("comments.php?action=removecomment&amp;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&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".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:

Code: [Select]
<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:

Code: [Select]
<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">&nbsp;</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 &amp; 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:

Code: [Select]
<table border="0" cellspacing="0" cellpadding="0">
   <form method="post" action="{self}?action=readcomments#comments" name="commentsperpage">
      <tr>
         
      <td>Comments per page:&nbsp;</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

Code: [Select]
&raquo; <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 ishttp://www.emarati.net/ShowReceivedComments.htm

and it was requested as I found here :

http://www.4homepages.de/forum/index.php?topic=10295.0

http://www.4homepages.de/forum/index.php?topic=4808.0

http://www.4homepages.de/forum/index.php?topic=8725.0

enjoy !
Title: Re: finally !! when login "u have xx comments"
Post by: Stoleti on April 25, 2006, 01:22:32 AM
there is no way to make userpic show in readcomments page ??
Title: Re: finally !! when login "u have xx comments"
Post by: tansamalaja on June 19, 2006, 11:14:58 PM
One problem:
The comments for pics in a hidden category are viewable too.
Title: Re: finally !! when login "u have xx comments"
Post by: stomka.net on June 24, 2006, 01:21:32 AM
Hi

i have question

how to  add the thumbnail of comment  image in member_commnt_ bit
thx for help
Title: Re: finally !! when login "u have xx comments"
Post by: Stoleti on July 30, 2006, 05:54:33 PM
theres a small problem...

why this only show comments received from others without show my own comments !?
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on July 30, 2006, 08:09:02 PM
are you sure about that? it supposed to show comments on your own images, no metter who posted them.
also, I see that once you "removed" the comments, you wont be able see new comments for the same image again...or am I wrong about that? (havent tryed this mod yet)
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: Stoleti on July 30, 2006, 08:48:13 PM
are you sure about that? it supposed to show comments on your own images, no metter who posted them.
also, I see that once you "removed" the comments, you wont be able see new comments for the same image again...or am I wrong about that? (havent tryed this mod yet)

yes, its about show the comments of who had comment at our pictures :) but i mean not show the comments by the owner of pic :) at "received comments" , only from the others :) not from the owner of the same :)
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on July 30, 2006, 08:52:58 PM
I dont see anything in the code that would filter own comments out...
Ok, here is how you can test it:
1) upload an image (dont forget to login)
2) post a comment for that image
3) logout and login under different member
4) post a comment as a different member or as a guest
5) logout and login under the member which uploaded the image
6) go to details page and make sure two comments are present
7) visit "last comments" page, see if the two comments are showed.
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: Stoleti on July 30, 2006, 08:55:30 PM
i've and ...

USER COMMENT

=> My comment

USER COMMENT

.... 8O

Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: ccsakuweb on August 13, 2006, 12:13:07 AM
hi! i have installed "Show user's commets from his profile" so i have did that Lucifiz said in http://www.emarati.net/ShowReceivedComments.htm
Quote from: Lucifiz
If you use that mode, I recomend that you change member_comment_bit.html into new_comment_bit.html.

Then change

 
Code: [Select]
    $comments .= $site_template->parse_template("member_comment_bit");

Into:

     
Code: [Select]
$comments .= $site_template->parse_template("new_comment_bit");

and i tried to insert a picture from the comment, but it only displays the thumb of the first image with a comment ...
please... could anyone help him and me? the code from Lucifiz is:

Quote from: Lucifiz
Here is a little modification if you want to see thumbnails next to comment. You can modify the width and height of thumbnail by changing dimesion:
$dimension = 75; <- 75px width (made by by V@no)

Open members.php,

Find:
Code: [Select]
  $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")."

Replace with:
Code: [Select]
  $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.cat_id, i.image_media_file, i.image_thumb_file, 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")."


Find:
Code: [Select]
LIMIT $offset, $commentperpage";

Add after:
Code: [Select]
  $image_row = $site_db->query_firstrow($sql);



Find:
Code: [Select]
elseif ($is_image_owner) {
        $admin_links .= ($config['user_edit_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=editcomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['edit']."</a>&nbsp;";
        $admin_links .= ($config['user_delete_comments'] != 1) ? "" : "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=removecomment&amp;".URL_COMMENT_ID."=".$comment_row[$i]['comment_id'])."\">".$lang['delete']."</a>";
      }

Add after:
Code: [Select]
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 = 75;
$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;
}

Find:
Code: [Select]
$site_template->register_vars(array(
       "count" => $i,


Add after:
Code: [Select]
       "newc_thumb" => (!check_permission("auth_viewcat", $cat_id) || !check_permission("auth_viewimage", $cat_id)) ? "<img src=\"".$thumb_file."\" width=\"".$new_width."\" height=\"".$new_height."\" style=\"border: 1px solid black;\" onClick=\"alert('".$lang['members_only']."');\" border=\"".$config['image_border']."\">" : "",

Now put {newc_thumb} somewhere in the file member_comment_bit.html
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: nfprehn on August 13, 2006, 05:04:58 PM
This works great!  Well almost, behind the dropdown on the right of "Comments per page"  I get

Quote
nn1n2n3n4n5n6n7n8n9n10n11n12n13n14n15nn


My member.php looks like this:

Code: [Select]
   $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);


Can anyone spot why this is happening?  I seem to be blind...  8O
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on August 13, 2006, 07:25:31 PM
missing backslashes:[qcode]     $commentsperpage_dropdown .= "</option>\n";
   }
   $commentsperpage_dropdown .= "</select>\n";
[/qcode]
(same thing in first line)
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: nfprehn on August 15, 2006, 08:03:09 PM
Thanks a lot V@no.   :mrgreen:

Is it possible to show the most recent comments first???  I remember doing this for the details page a while ago, but I just cannot find how that was done...  It must be my eyes again...  8O
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on August 16, 2006, 01:25:15 AM
replace
Code: [Select]
      ORDER BY c.comment_date ASC with:
Code: [Select]
      ORDER BY c.comment_date DESC
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: lemccoy on August 18, 2006, 03:53:04 PM
Can anyone create one of those autoinstall files for the database entry?  I haven't figured out how to do this manually yet and am work which I can't install software.

Thanks!
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on August 19, 2006, 06:20:35 AM
use phpmyadmin and execute this query:[qcode]ALTER TABLE 4images_comments ADD is_read TINYINT( 1 ) DEFAULT '0' NOT NULL
[/qcode]
Prefix 4images_ is default, so leave it like that UNLESS you use different prefix for the tables.
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: lemccoy on September 08, 2006, 03:35:16 PM
I have created an autoinstall file which works...any comments feel free...

rename .txt to .php
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: lemccoy on September 08, 2006, 04:12:38 PM
did anyone figure out how to show thumbnails below the image name by any chance?
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: troopers on September 13, 2006, 10:36:49 AM
Hi,

if you want to display the commented image in the comment_template, do the following steps.

open member.php:

find:
Code: [Select]
$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";

edit to:
Code: [Select]
$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,i.image_thumb_file,i.cat_id".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";


find:     
Code: [Select]
$image_link = "<b><a href=\"".$image_url."\">".$comment_row[$i]['image_name']."</a></b>";
below add:
Code: [Select]
$comment_image = "<a href=\"".$image_url."\"><img src=\"".THUMB_PATH."/".$comment_image_id."/".$comment_image."\" border=\"0\"/></a>"; 

find:   
Code: [Select]
$site_template->register_vars(array(
       "count" => $i,
      "image_name" => $image_link,
        "comment_id" => $comment_row[$i]['comment_id'],

add below:
Code: [Select]
  "comment_image" => $comment_image,       
find:

Code: [Select]
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'];


add below:       
Code: [Select]
$comment_image = $comment_row[$i]['image_thumb_file'];
      $comment_image_id = $comment_row[$i]['cat_id'];     


open your comment_template & use
Code: [Select]
{comment_image} for the image. dont forget, the comment_image is the thumbnail which was generated. if you want a smaller version of the thumb, try phpthumb :) (pls don't resize with html tags)


i hope i don't forget now something (i edited this reply 6 times -g-) :D
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: stomka.net on September 13, 2006, 06:06:53 PM
Thx troopers

thumb display correct. :lol: :lol: :lol:
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: nfprehn on September 14, 2006, 07:50:08 PM
Thanks V@no that is a neater solution than ccsakuweb's.

Now the real challenge is to include the personal image of the person who left the comment!  :lol:
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: hyde101 on September 24, 2006, 09:55:57 PM
Hi everyone, is there anyway to add another button below Comments (x) so that guests can also see the "latest comments" using this mod? I just want guests to be able to see last 10 comments or something like that.

Thank You.
Title: Re: finally !! when login "u have xx comments"
Post by: AntiNSA2 on December 26, 2006, 12:37:25 PM
One problem:
The comments for pics in a hidden category are viewable too.



Has anyone figured out how to solve this problem? I use this mod and love it, but I need to controll what they are allowed to see .

Thanks-
Robert
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: ccsakuweb on December 28, 2006, 12:03:10 PM
 I have a problem.. when i delete a comment the next time that i login the comment deleted is there shown... who have the same problem??
I think that I know how to add the userpic but I need to know how to solve my problem please
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: tansamalaja on June 19, 2007, 11:08:36 AM
Es werden aber alle Kommentare zu den eigenen Bildern angezeigt, auch aus Kategorien, wo die User keinen Einblick haben sollen z.B. Entscheidungsordner über die Zulassung von Bildern, kann man das unterbinden?

Also wenn ich den Ordner mit den Kommentarrechten auf "privat/Administratoren" stehen habe, dass die dort gemachten Kommentare nicht für den User angezeigt werden?
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: AntiNSA2 on March 12, 2009, 07:20:05 PM
I am trying to find out how to show recent comments for category only and its subcat to show on the category.html

I have created a new thread here: http://www.4homepages.de/forum/index.php?topic=24380.new#new since it is different than this mod kind of.


Can you put your brainpower to this new idea and awsome complimentary mod V@no? Thanks!
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: fermachado on March 20, 2009, 10:52:26 AM
Hi,

I have a little problem.

If delete the comments in my received comments just delete here, don't delete in the standart comments.

I use this [MOD] Last comments v1.1.0 to

I make a example with the image bellow
(http://fotogenicos.net/uploads/fer/Untitled%201.jpg)

Thanks
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: Sunny C. on March 20, 2009, 12:30:15 PM
Was genau ist denn das?
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: fermachado on March 20, 2009, 01:12:31 PM
Was genau ist denn das?

I don't understand German! 8O but I think you don't understand my question. :lol:

The problem are:

If I delete the photo whit the option remove selected just delete in this page don't delete bellow the photo.

Hope understand my poor english

Greetings from Portugal

Fernando

Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on March 20, 2009, 02:35:49 PM
I don't think I completely understand what is the problem you described, but did you apply ALL the bug fixes? particularly [1.7 - 1.7.6] User comments count not updated when image(s) deleted (http://www.4homepages.de/forum/index.php?topic=23644.0)
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: fermachado on March 20, 2009, 04:20:30 PM
Hi Vano,

Thanks for your help.

I'm stupid,just now I understand how this work. :oops:

I'm confused with the remove select, just now understand this option is only to delete the comments I've read from the list. :oops:

Sorry my stupid question

thanks,
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: crs on May 29, 2009, 07:29:42 PM
Hello

The Mod is working on my 4images v1.7.6, but i got a problem.

If i choose the "Comments per page" dropdown menu, maybe i set it to 10 comments per page  - i get redirected to the "Forgot password" site and for sure im not able to set more than 5 Comments per page over the dropdown menu.

It looks also like an error in the code, because there is a "n" displayed after the text "Comments per page: n"
I´ve also done the fix with the lost backslashes \, but that didn´t help.

I have also installed the Mod: "[MOD] All Comments (Alle Kommentare) V.1.4" maybe that could be the problem?
http://www.4homepages.de/forum/index.php?topic=10632.0

Thanks for help!
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: crs on August 02, 2009, 05:09:14 AM
No-one can help?  :cry:
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: V@no on August 02, 2009, 06:06:51 AM
Can I see it in action?
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: fermachado on August 07, 2009, 09:16:21 PM
Hi,

Can help me we that,please.

I show in the received comments a normal thumbnail with 120px.But I need a small thumbnaIL something like the image in attach.

How I can do that?

Thanks,
Fernando
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: mawenzi on August 07, 2009, 09:46:07 PM
@fermachado

... use a second thumbnail-size :  [MOD] Second Thumbnail Size ...
... http://www.4homepages.de/forum/index.php?topic=25017.0 ...
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: fermachado on August 07, 2009, 11:16:17 PM
@fermachado

... use a second thumbnail-size :  [MOD] Second Thumbnail Size ...
... http://www.4homepages.de/forum/index.php?topic=25017.0 ...

Hi tanks for your help

Tried your code and works if use {thumbnail_small} but have a problem.To show the thumbnail in the received comments use {comment_image} . :|

I use the code from page 2 of this topic from "troopers"

http://www.4homepages.de/forum/index.php?topic=12695.15 (http://www.4homepages.de/forum/index.php?topic=12695.15)


Title: moderator indicated as guest when adding a comment to an image
Post by: surferboy on March 09, 2010, 07:27:56 AM
To the moderators;

Not sure where to post this reply since it applies to two MODs - this multi-moderator, and the show received comment, http://www.4homepages.de/forum/index.php?topic=12695.0  Have posted on both MOD topics.

The problem is that the received comment MOD does not have a category for moderator, and therefore, when comments are made on images that have been posted by a moderator, 4images or the received comment MOD highlights the image comment author as 'guest.'

What changes need to be made, if any, to this MOD, to properly affect the received comment MOD, or it a code issue with the received comment MOD?

Thanks,

Brian
Title: Re: [MOD] Show Received Comments V.2 (by rproctor)
Post by: TRAKTOR_WEB on October 04, 2012, 09:35:41 AM
Подскажите пожалуйста как сделать чтобы свои комментарии не учитывались на этой странице?