Hello, this is my first MOD, so I am going to try to explain everything as clearly as possible so there are no confussions.
First of all, I want to note that there is another mod that talks about Top Uploaders, but I looked at it, and it was a little bit outdated and some of the things didn't work, as far as I recall, and the one I'm going to post is more complete.
I'm going to post three versions of this module:1. Simple version, ads a new horizontal table with the top 3 uploaders (can be changed to whatever number you want).
2. Medium version, ads a vertical table with the top 5 uploaders including avatars (can be changed to whatever number you want).
- Here is my site with the Medium Version implemented:
http://www.anime.igc-web.com/gallery/3. Complete version, ads a big table with top 10 uploaders including avatar, avg rating for uploaded files with at least 1 vote and # of votes (can be changed to whatever number you want).[/color]
- You can check it out on my site as well:
http://www.anime.igc-web.com/gallery/top_uploaders.phpHere we go.
Simple version---------------[Changed / new files]--------------------
Changed files
includes/page_header.php
lang/<your language>/main.php
templates/<your template>/home.html
New files
templates/<your template>/top_uploaders_small.html
---------------[Installation]-----------------------
Step 1
Open includes/page_header.php
At the end just above ?> add:
//-----------------------------------------------------
//--- Top Uploaders Small -----------------------------
//-----------------------------------------------------
$top_uploaders_small = "<table width=100% cellpadding=0 cellspacing=0><tr>";
$sql = "SELECT user_name, users.user_id, count( image_id ) uploaded
FROM ".IMAGES_TABLE." img, ".USERS_TABLE." users
WHERE users.user_id = img.user_id
AND user_level = ".USER."
GROUP BY user_id
ORDER BY uploaded DESC
LIMIT 0 , 3"; //CHANGE THIS TO GET MORE USERS
$result = $site_db->query($sql);
while($row = $site_db->fetch_array($result)) {
$top_uploaders_small .= "<td><a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><b>".$row['user_name']."</b></a> (".$row['uploaded']." uploads)</td>";
}
$top_uploaders_small .= "</tr></table>";
$site_template->register_vars(array(
"lang_top_uploaders_small" => $lang['lang_top_uploaders_small'],
"top_uploaders_small" => $top_uploaders_small));
$site_template->register_vars("top_uploaders_small_bit", $site_template->parse_template("top_uploaders_small_bit"));
unset($top_uploaders_small_bit);
unset($top_uploaders_small);
Step 2
Open lang/<your language>/main.php
At the end just above ?> add:
//-----------------------------------------------------
//--- Top Uploaders Small -----------------------------
//-----------------------------------------------------
$lang['lang_top_uploaders_small'] = "Top 3 uploaders";
Step 3
Open templates/<your template>/home.html
Wherever you want to place the top upladers information (below new images, below your news, below your list of active users....) add:
{top_uploaders_small_bit}
<br />
Step 4
Create a file called top_uploaders_small_bit.html with:
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td class="head1">
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td valign="top" class="head1">{lang_top_uploaders_small}</td>
</tr>
<tr>
<td valign="top" class="row2">{top_uploaders_small}</td>
</tr>
</table>
</td>
</tr>
</table>
And upload it to: templates/<your template>/
And we are done!!
You can add {top_uploaders_small_bit} on any of your template files, wherever you want to display the statistics.
Medium version---------------[Changed / new files]--------------------
Changed files
includes/page_header.php
lang/<your language>/main.php
templates/<your template>/home.html
New files
templates/<your template>/top_uploaders_medium.html
---------------[Installation]-----------------------
Step 1
Open includes/page_header.php
At the end just above ?> add:
//-----------------------------------------------------
//--- Top Uploaders Medium ----------------------------
//-----------------------------------------------------
$top_uploaders_medium= "<table width=100% cellpadding=0 cellspacing=0 style=\"padding-left:3px; padding-right:3px;\">";
$sql = "SELECT user_name, users.user_id, count( image_id ) uploaded, user_avatar
FROM ".IMAGES_TABLE." img, ".USERS_TABLE." users
WHERE users.user_id = img.user_id
AND user_level = ".USER."
GROUP BY user_id
ORDER BY uploaded DESC
LIMIT 0 , 5"; //CHANGE THIS TO GET MORE USERS
$result = $site_db->query($sql);
while($row = $site_db->fetch_array($result)) {
$top_uploaders_medium .= "<tr><td align=center style=\"padding-top:3px; padding-bottom:2px;\">";
if($row['user_avatar'] == "")
$top_uploaders_medium .= "<a href=\"" .$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><img src=\"".TEMPLATE_PATH."/avatars/blank.gif\" border=0 /></td></tr>";
else
$top_uploaders_medium .= "<a href=\"" .$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\"><img src=\"".TEMPLATE_PATH."/avatars/".$row['user_avatar']."\" border=0 /></a></td></tr>";
$top_uploaders_medium .= "<tr><td align=center style=\"padding-bottom:2px;\"><a href=\"" .$site_sess->url(ROOT_PATH."member.php?action=showprofile&user_id=".$row['user_id'])."\">".$row['user_name']."</a></td></tr>";
$top_uploaders_medium .= "<tr><td align=center style=\"border-bottom:1px dashed black; padding-bottom:3px;\"><b>".$row['uploaded']."</b> uploads</td></tr>";
}
$top_uploaders_medium.= "</tr></table>";
$site_template->register_vars(array(
"lang_top_uploaders_medium" => $lang['lang_top_uploaders_medium'],
"top_uploaders_medium" => $top_uploaders_medium));
$site_template->register_vars("top_uploaders_medium_bit", $site_template->parse_template("top_uploaders_medium_bit"));
unset($top_uploaders_medium_bit);
unset($top_uploaders_medium);
Step 2
Open lang/<your language>/main.php
At the end just above ?> add:
//-----------------------------------------------------
//--- Top Uploaders Medium ----------------------------
//-----------------------------------------------------
$lang['lang_top_uploaders_medium'] = "Top 5 uploaders";
Step 3
Note: this will add a right panel on your site for the top uploaders section. If you don't want the panel and want to put the table in the middle of the site, you should modify the template file accordingly
Open templates/<your template>/home.html
Find:
<td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
</tr>
</table>
for other template files the same code may be shown as:
<td width="20" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
</tr>
</table>
Replace with:
<td width="19" valign="top"><img src="{template_url}/images/spacer.gif" alt="" width="19" height="19" /></td>
<td width="150" class="row2" valign="top" style="border-left:1px solid black;">
{top_uploaders_medium_bit}
</td>
</tr>
</table>
Step 4
Note: Same as for step 3, this part is designed to fill the right panel we created. If you are going to put the table some place else, you will need to change this template accordingly to fit your site's design.
Create a file called top_uploaders_medium_bit.html with:
<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_top_uploaders_medium}</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">{top_uploaders_medium}</td>
</tr>
<tr>
<td class="tablebgcolor"><img src="{template_url}/images/spacer.gif" alt="" width="1" height="1" /></td>
</tr>
</table>
And upload it to: templates/<your template>/
And we are done!!
You can recreate step 3 on any of: home.html, top.html, search.html, categories.html, lightbox.html, details.html, error.html, member.html, register.html and postcard_create.html (which are the big template files)
My site has this version implemented: http://www.anime.igc-web.com/gallery/
Complete version---------------[Changed / new files]--------------------
Changed files
lang/<your language>/main.php
templates/<your template>/home.html
New files
top_uploaders.php
templates/<your template>/top_uploaders.html
templates/<your template>/images/0.png ... 10.png
---------------[Installation]-----------------------
Step 1
Open lang/<your language>/main.php
At the end just above ?> add:
//-----------------------------------------------------
//--- Top Uploaders -------------------------------------
//-----------------------------------------------------
$lang['lang_top_uploaders_complete'] = "Top uploaders";
$lang['lang_top_by_uploads'] = "by uploads";
$lang['lang_top_by_rating'] = "by rating";
$lang['lang_top_by_hits'] = "by hits";
$lang['lang_top_by_votes'] = "by votes";
Step 2
Note: this will add an extra link on the top-right part of your main page. Where "Top images" and "New images" are located. If you don't want the extra link or you have changed your layout, you should modify the template file accordingly
Open templates/<your template>/home.html
Find:
<a href="{url_top_images}"><b>{lang_top_images}</b></a>
<a href="{url_new_images}"><b>{lang_new_images}</b></a>
Just above add:
<a href="top_uploaders.php"><b>{lang_top_uploaders_complete}</b></a>
Step 3
NOTE: This section assumess that you have installed mod avatar and have a rating scale of 0 to 10.
If you do not have either of these, you should modify top_uploaders.php to fit your needs. (It should not be too hard)
Download the attached file top_uploaders.txt, rename it to top_uploaders.php and place it on your 4images root directory, next to index.php, top.php, details.php....
Step 4
Note: Same as for step 2, this part is designed to fill the newly created page and follows the basic layout of 4images. If you have changed your layout, you may need to make some modifications to the following code
Create a file called top_uploaders.html with:
a. Copy the code from templates/<your template>/top.html into the new file.
This will mantain your layout as much possible.
b. Delete all the text in between these two lines (including the two lines):
<span class="title">{lang_top_images}</span>
<p> </p>
c. In the part we just deleted, place the text on the attached file: paste_this.txt
And upload it to: templates/<your template>/
Step 5
Upload the following image files (0.png ... 10.png) to templates/<your template>/images/
Of course you can create your own images...
And we are done!!
You can recreate step 3 on any of: home.html, top.html, search.html, categories.html, lightbox.html, details.html, error.html, member.html, register.html and postcard_create.html (which are the big template files)
My site has this version implemented: http://www.anime.igc-web.com/gallery/