Author Topic: [MOD] Top Member with the most Comments  (Read 14177 times)

0 Members and 1 Guest are viewing this topic.

Rembrandt

  • Guest
[MOD] Top Member with the most Comments
« on: December 01, 2009, 06:57:23 PM »
Hi!

Mit dieser Modifikation werden die User mit den meisten Kommentaren angezeigt.
Angezeigt werden: Rang, - Username, - anzahl Kommentare, - das Datum des letzten eintrages, - bei welchen Bild, - und wann war der User zuletzt Online.

Demo: Demo

Neue Dateien:
top_member.php
top_member.html


1.) erstellt einen neue datei "top_member.php" und kopiert sie in euren 4images root. //creates a new file "top_member.php" and copy it into your root 4images

<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: top_member.php                                              *
 *        Copyright: (C) 2002-2009 Jan Sorgalla                           *
 *            Email: jan@4homepages.de                                    * 
 *              Web: http://www.4homepages.de                             * 
 *    Scriptversion: 1.7.7                                                *
 *     File Version: 1.0.0 (by Rembrandt www.vienna-pictures.com)         *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

$main_template 'top_member';

define('GET_CACHES'1);
define('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$user_access get_permission();
include(
ROOT_PATH.'includes/page_header.php');

 
$cache_id create_cache_id(
  
'page.top_member',
  array(
    
$user_info[$user_table_fields['user_id']],
    
$cat_id,
    
$config['template_dir'],
    
$config['language_dir']
  )
);

if (!
$cache_page_top || !$content get_cache_file($cache_id)) {
if (
$cache_page_top) {
  
// Always append session id if cache is enabled
  
$old_session_mode $site_sess->mode;
  
$site_sess->mode 'get';
}

ob_start();

$cat_id_sql get_auth_cat_sql("auth_viewcat""NOTIN");

$sql "SELECT MAX(comment_id) AS anzahl ,user_name,image_id,comment_date
	
	
	
 FROM "
.COMMENTS_TABLE."
	
	
	
 GROUP BY user_name
	
	
	
 ORDER BY anzahl ASC"
;     
	
	
 
$result $site_db->query($sql); 
	
	
while (
$image_row $site_db->fetch_array($result)){
	
	
     
$image_test[]= $image_row['anzahl'];
	
    }
	
	
	

 
$sql "SELECT o.comment_id ,o.user_name, o.image_id, o.comment_date,o.comment_headline, u.user_comments,u.user_id, u.user_name,u.user_lastaction,i.image_id,i.cat_id,i.image_name
            FROM ("
.COMMENTS_TABLE." o,".USERS_TABLE." u,".IMAGES_TABLE." i)
            WHERE comment_id IN ("
.implode(", ",$image_test).") AND o.user_name = u.user_name AND i.image_id = o.image_id AND i.image_active = 1 
            ORDER BY user_comments DESC
            LIMIT 100
            "

	
	
	
	

	
	
 
$result $site_db->query($sql); 

 
$comments "<table style=\"width:".$config['image_table_width'].";\" cellpadding=\"".$config['image_table_cellpadding']."\" cellspacing=\"0\"summary=\"comments\">";
  
$comments .= "<tr class=\"imagerow2\">\n";
	
$comments .= "<td  class=\"head1\"style=\"width:5%;text-align:center; \"><b>".$lang['top_comments_ranking']."</b></td>\n";
	
$comments .= "<td  class=\"head1\"style=\"width:20%;text-align:center; \"><b>".$lang['top_comments_user']."</b></td>\n";
	
$comments .= "<td  class=\"head1\"style=\"width:8%;text-align:center; \"><b>".$lang['top_comments_comments']."</b></td>\n";
	
$comments .= "<td  class=\"head1\"style=\"width:15%;text-align:center; \"><b>".$lang['top_comments_date']."</b></td>\n";
	
$comments .= "<td  class=\"head1\"style=\"width:28%;text-align:center; \"><b>".$lang['top_comments_images']."</b></td>\n";
	
$comments .= "<td  class=\"head1\"style=\"width:15%;text-align:center; \"><b>".$lang['top_comments_lastaction']."</b></td>\n";
	
$comments .= "</tr>\n";
	

	
$count 0;
  
$bgcounter 0;
	
$rank 1;
  while (
$row $site_db->fetch_array($result)){
	
$row_bg_number = ($bgcounter++ % == 0) ? 2;
	
$comments .= "<tr class=\"imagerow".$row_bg_number."\">\n";
   
  
$comments .= "<td  style=\"width:5%;text-align:center; \">".$rank++."</td>\n"
	
	
if (isset(
$row[$user_table_fields['user_name']]) && $row['user_id'] != GUEST) {
$user_profile_link = (!empty($url_show_profile)) ? preg_replace("/{user_id}/"$row['user_id'], $url_show_profile) : ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$row['user_id'];
  
$comments .= "<td  style=\"width:20%;text-align:center; \"><a href=\"".$site_sess->url($user_profile_link)."\">".format_text($row[$user_table_fields['user_name']])."</a></td>\n";
	
	
}
	
	
else {
 
$comments .= "<td  style=\"width:20%;text-align:center; \">".$lang['userlevel_guest']."</td>\n";
	
	

 
$comments .= "<td  style=\"width:8%;text-align:center; \">".format_text($row[$user_table_fields['user_comments']])."</td>\n";
 
$comments .= "<td  style=\"width:15%;text-align:center; \">".date("d-m-Y H:i",$row['comment_date'])."</td>\n";
  
$comments .= (in_array($row['cat_id'], explode(","$cat_id_sql)) != $row['cat_id']) ? "<td style=\"width:28%;text-align:center; \"><a href=".$site_sess->url(ROOT_PATH."details.php?".URL_IMAGE_ID."=".$row['image_id']).">" .format_text($row['image_name'], 2)."</a></td>\n" "<td style=\"width:28%;text-align:center; \">".format_text($row['image_name'], 2)."</td>\n";
  
$comments .= "<td  style=\"width:15%;text-align:center; \">".date("d-m-Y H:i",$row['user_lastaction'])."</td>\n";
	
 
	
	
$count++;
    if (
$count == $comments_num) {
      
$comments .= "</tr>\n";
      
$count 0;
    }
	

  } 
// end while
	

  if (
$count 0)  {
    
$leftover = ($comments_num $count);
    if (
$leftover >= 1) {
      for (
$f 0$f $leftover$f++) {
        
$comments .= "<td style=\"width:".$imgtable_width."\">\n&nbsp;\n</td>\n";
      }
      
$comments .= "</tr>\n";
    }
  }
  
$comments .= "</table>\n";

$site_template->register_vars("comments_rank"$comments);
//-----------------------------------------------------
//--- Clickstream -------------------------------------
//-----------------------------------------------------
$clickstream "<span class=\"clickstream\"><a href=\"".$site_sess->url(ROOT_PATH."index.php")."\" class=\"clickstream\">".$lang['home']."</a>".$config['category_separator'];
if (
$cat_id && isset($cat_cache[$cat_id])) {
  
$clickstream .= get_category_path($cat_id1).$config['category_separator'];
}
$clickstream .= $lang['top_comments']."</span>";

//-----------------------------------------------------
//--- Print Out ---------------------------------------
//-----------------------------------------------------
$site_template->register_vars(array(
  
"msg" => $msg,
  
"clickstream" => $clickstream,
	
"lang_top_comments" => $lang['top_comments'],
	
"lang_comments_member" => $lang['top_comments_member'],
	
"lang_comments_ranking" => $lang['top_comments_ranking'],
	
"lang_comments_user"  =>$lang['top_comments_user'],
	
"lang_comments_comments" => $lang['top_comments_comments'],
	
"lang_comments_date" => $lang['top_comments_date'],
	
"lang_comments_images" => $lang['top_comments_images'],
	
"lang_comments_lastaction" => $lang['top_comments_lastaction'],
	
	
 
));
$site_template->print_template($site_template->parse_template($main_template));

$content ob_get_contents();
ob_end_clean();

if (
$cache_page_top) {
  
// Reset session mode
  
$site_sess->mode $old_session_mode;

  
save_cache_file($cache_id$content);
}

// end if get_cache_file()

echo $content;

include(
ROOT_PATH.'includes/page_footer.php');
?>



2.) erstellt eine neue datei "top_member.html" und kopiert sie in euer templates verzeichniss. //creates a new file "top_member.html" and copy it into your template directories.
Code: [Select]
{header}
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablehead">
        <tr>
          <td width="100%" colspan="4"><table cellpadding="0" cellspacing="0" width="100%">
    <tr>
        <td width="6"><img src="{template_url}/images/header_top_left.gif" width="6" height="6" alt="" /></td>
        <td width="100%"><img src="{template_url}/images/header_top.gif" width="100%" height="6" alt="" /></td>
<td width="6"><img src="{template_url}/images/header_top_right.gif" width="6" height="6" alt="" /></td>
    </tr>
</table>
</td>
        </tr>
        <tr>
          <td width="6"><img src="{template_url}/images/header_left.gif" width="6" height="60" alt="" /></td>
          <td width="100%"><img src="{template_url}/images/header_logo.gif" width="405" height="60" alt="" /></td>
          <td width="225" align="right">
            <form method="post" action="{url_search}">
              <table border="0" cellspacing="0" cellpadding="1">
                <tr>
                  <td>
                    <input type="text" name="search_keywords" size="15" class="searchinput" />
                  </td>
                  <td>
                    <input type="submit" value="{lang_search}" class="button" name="submit" />
                  </td>
                </tr>
                <tr valign="top">
                  <td colspan="2"><a href="{url_search}" class="smalltext">{lang_advanced_search}</a></td>
                </tr>
              </table>
            </form>
          </td>
          <td align="right" width="6"><img src="{template_url}/images/header_right.gif" width="6" height="60" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td class="bordercolor">
      <table width="100%" border="0" cellspacing="1" cellpadding="0">
        <tr>
          <td class="tablebgcolor">
            <table width="100%" border="0" cellspacing="1" cellpadding="0">
              <tr>
                <td class="navbar" height="23">
                  <table width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td><img src="{template_url}/images/spacer.gif" width="4" height="4" alt="" />{clickstream}</td>
                      <td align="right">
<a href="{url_top_comments}"><b>{lang_top_comments}</b></a>&nbsp;
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;
<a href="{url_new_images}"><b>{lang_new_images}</b></a>&nbsp;
 </td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="150" class="row2" valign="top">
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"><img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_registered_user}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">{user_box}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {if random_image}
                  <table width="150" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td class="head2" height="20"> <img src="{template_url}/images/spacer.gif" alt="" width="4" height="4" />{lang_random_image}</td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                    <tr>
                      <td align="center" class="row1">
   <br />
                        {random_image}
<br />
                        <br />
                      </td>
                    </tr>
                    <tr>
                      <td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                    </tr>
                  </table>
                  {endif random_image}
                </td>
                <td width="1" class="bordercolor" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
                <td width="18" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="18" height="18" /></td>
                <td width="100%" valign="top">
 <br />
                  <span class="title">{lang_comments_member}</span>
                  <hr size="1" />
                  <table width="100%" border="0" cellspacing="0" cellpadding="1">
                    <tr>
                      <td class="bordercolor">
                        {comments_rank}
                      </td>
                    </tr>
                  </table>
                  <p>&nbsp;</p>
                </td>
                <td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td>
      <table width="100%" border="0" cellspacing="0" cellpadding="0" class="tablebottom">
        <tr>
          <td width="6" nowrap><img src="{template_url}/images/footer_left.gif" width="6" height="19" alt="" /></td>
          <td width="100%"></td>
          <td width="6" nowrap><img src="{template_url}/images/footer_right.gif" width="6" height="19" alt="" /></td>
        </tr>
      </table>
    </td>
  </tr>
</table>
{footer}


3.) sucht in eurer templates/home.html: //search in your templates / home.html:
Code: [Select]
<a href="{url_top_images}"><b>{lang_top_images}</b></a>&nbsp;

und fügt darüber ein: //above
Code: [Select]
<a href="{url_top_comments}"><b>{lang_top_comments}</b></a>&nbsp;

4.) sucht in lang/deutsch/main.php: //search in lang/yourLang/main.php:

//-----------------------------------------------------
//--- Comments ----------------------------------------
//-----------------------------------------------------


fügt darunter ein: //below

//#################################### Start Top Comments #################################################
$lang['top_comments'] = "Top Kommentare";
$lang['top_comments_member'] = "Mitglieder mit den meisten Kommentaren";
$lang['top_comments_ranking']= "Rang"
$lang['top_comments_user']= "Mitglied";
$lang['top_comments_comments']= "Kommentare";
$lang['top_comments_date']= "Datum";
$lang['top_comments_images']= "Bildname";
$lang['top_comments_lastaction']=
	
"Zuletzt Online";
//#################################### End Top Comments #################################################

for english lang/english/main.php: //below

//#################################### Start Top Comments #################################################
$lang['top_comments'] = "Top Comments";
$lang['top_comments_member'] = "Member with the most Comments";
$lang['top_comments_ranking']= "Ranking"
$lang['top_comments_user']= "Member";
$lang['top_comments_comments']= "Comments";
$lang['top_comments_date']= "Date";
$lang['top_comments_images']= "Image";
$lang['top_comments_lastaction']= "Last Action";
//#################################### End Top Comments #################################################



5.) sucht in includes/page_header.php: //search in includes/page_header.php:

"url_top_images" => $site_sess->url(ROOT_PATH."top.php"),


fügt darüber ein: //above:

//#################################### Start Top Comments #################################################
	
"url_top_comments" => $site_sess->url(ROOT_PATH."top_member.php"),
//#################################### End Top Comments #################################################


suche: //search:

"lang_new_images" => $lang['new_images'],


füge darüber ein: //above:

//#################################### Start Top Comments #################################################
	
 
"lang_top_comments" => $lang['top_comments'],                         
//#################################### End Top Comments #################################################


In der top_member.php wurde die Anzahl der anzuzeigenden User in der zweiten SQL abfrage auf "LIMIT 100" begrenzt, die Zahl könnt ihr nach eigenen ermessen ändern.
//In top_member.php was the number of users displayed in the second SQL query to "LIMIT 100" limited the number you can change according to its own measure.

Wie immer hoffe ich das ich nicht vergessen habe. :)

Viel Spass!

mfg Andi
« Last Edit: July 26, 2010, 02:37:19 PM by Rembrandt »

Offline milezone

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [MOD] Top Member with the most Comments
« Reply #1 on: December 24, 2009, 11:39:30 PM »
Do you have a english version for this script?  I am not understanding how to install.  Thanks

TDL

Offline V@nо

  • Addicted member
  • ******
  • Posts: 1.223
    • View Profile
Re: [MOD] Top Member with the most Comments
« Reply #2 on: December 24, 2009, 11:45:10 PM »
page translator is on top of each page.
Your first three "must do" before you ask a question:
If I asked you to PM me, I meant PM to my primary account, this account doesn't accept PMs.

Offline milezone

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [MOD] Top Member with the most Comments
« Reply #3 on: December 26, 2009, 01:26:15 AM »
Sorry for my dumb question, but I am not sure which languagethis is.  :-(

Russ

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] Top Member with the most Comments
« Reply #4 on: December 26, 2009, 01:44:17 AM »
It's german.
4images is german software ;) for your information :)
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)

Rembrandt

  • Guest
Re: [MOD] Top Member with the most Comments
« Reply #5 on: December 26, 2009, 07:02:08 AM »
Hi!
.. but I am not sure which languagethis is.  ...

so.. i have only for you the mod translated :)
translate with google, which is so easy:

darüber > above
darunter  > below
suche > search
erstellt > created

mfg Andi

Offline luener

  • Jr. Member
  • **
  • Posts: 54
  • Pessimisten sind Optimisten mit mehr Erfahrung!
    • View Profile
    • TopFoto24.com
Re: [MOD] Top Member with the most Comments
« Reply #6 on: April 16, 2010, 11:00:59 AM »
Danke dafür...klappt prima..!

Gruß
Ralf

Offline www.katzen.ag

  • Jr. Member
  • **
  • Posts: 75
  • KatzenAG - das grosse Katzenportal im Internet
    • View Profile
    • KatzenAG - das grosse Katzenportal im Internet
Re: [MOD] Top Member with the most Comments
« Reply #7 on: July 26, 2010, 02:12:04 PM »
Funktioniert prima!

Nur Limit 100 ist bei der sql Abfrage nicht zu finden. Hab es so gemacht:

Code: [Select]
$sql = "SELECT o.comment_id ,o.user_name, o.image_id, o.comment_date,o.comment_headline, u.user_comments,u.user_id, u.user_name,u.user_lastaction,i.image_id,i.cat_id,i.image_name
FROM (".COMMENTS_TABLE." o,".USERS_TABLE." u,".IMAGES_TABLE." i)
WHERE comment_id IN (".implode(", ",$image_test).") AND o.user_name = u.user_name AND i.image_id = o.image_id AND i.image_active = 1
  ORDER BY user_comments DESC LIMIT 100";

Demo:

http://www.katzen.ag/top_member.php
KatzenAG - das grosse Katzenportal im Internet