• [MOD] Show Received Comments V.2 (by rproctor) 5 0 5 1
Currently:  

Author Topic: [MOD] Show Received Comments V.2 (by rproctor)  (Read 66582 times)

0 Members and 1 Guest are viewing this topic.

Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
[MOD] Show Received Comments V.2 (by rproctor)
« 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
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 !
« Last Edit: July 30, 2006, 08:03:27 PM by V@no »

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: finally !! when login "u have xx comments"
« Reply #1 on: April 25, 2006, 01:22:32 AM »
there is no way to make userpic show in readcomments page ??

Offline tansamalaja

  • Full Member
  • ***
  • Posts: 185
    • View Profile
Re: finally !! when login "u have xx comments"
« Reply #2 on: June 19, 2006, 11:14:58 PM »
One problem:
The comments for pics in a hidden category are viewable too.

Offline stomka.net

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: finally !! when login "u have xx comments"
« Reply #3 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

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: finally !! when login "u have xx comments"
« Reply #4 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 !?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #5 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)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #6 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 :)

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #7 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.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Stoleti

  • Hero Member
  • *****
  • Posts: 574
    • View Profile
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #8 on: July 30, 2006, 08:55:30 PM »
i've and ...

USER COMMENT

=> My comment

USER COMMENT

.... 8O


Offline ccsakuweb

  • Sr. Member
  • ****
  • Posts: 498
  • Patri
    • View Profile
    • My Art
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #9 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
« Last Edit: August 13, 2006, 02:07:06 AM by ccsakuweb »
:arrow: 4images Paid Mods: Links, Blog, Albums, Subdomains for users, Diferent templates for user profile, Related picture in details, Last pictures in details.
And the mod that you request me.   Demo: http://www.myart.es

A website dedicated to artist people who loves drawing, design, writing and more

Offline nfprehn

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • How to become a model
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #10 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #11 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)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline nfprehn

  • Newbie
  • *
  • Posts: 41
    • View Profile
    • How to become a model
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #12 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

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #13 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
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline lemccoy

  • Jr. Member
  • **
  • Posts: 90
    • View Profile
    • DrunkIsland
Re: [MOD] Show Received Comments V.2 (by rproctor)
« Reply #14 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!