4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Releases & Support) => Topic started by: Lunat on December 25, 2008, 04:48:53 PM
-
Hello all! The mod's creator is alekinna (http://www.4homepages.de/forum/index.php?action=profile;u=21731), and my idea.
this MOD add rank by quantity of comments and by quantity of photos in comment_bit.html and member_profile.html.
If user has 0 photos or comments - he is passive
1-10 - beginner
10-50 - active
50-100 - super
>100 - MEGA :D
So,
1. First install this (http://www.4homepages.de/forum/index.php?topic=22606.msg129401) and this (http://www.4homepages.de/forum/index.php?topic=23644.0) patches from V@no.
2. File includes/functions.php
before ?> add:
function get_rank($count, $mode) {
global $lang;
if ($count == 0) {
$rank_commentator = $lang['passive'].$lang['commentator'];
$rank_photographer = $lang['passive'].$lang['photographer'];
}
elseif ($count >= 1 && $count < 10) {
$rank_commentator = $lang['beginner'].$lang['commentator'];
$rank_photographer = $lang['beginner'].$lang['photographer'];
}
elseif ($count >= 10 && $count < 50) {
$rank_commentator = $lang['active'].$lang['commentator'];
$rank_photographer = $lang['active'].$lang['photographer'];
}
elseif ($count >= 50 && $count < 100) {
$rank_commentator = $lang['super'].$lang['commentator'];
$rank_photographer = $lang['super'].$lang['photographer'];
}
else {
$rank_commentator = $lang['mega'].$lang['commentator'];
$rank_photographer = $lang['mega'].$lang['photographer'];
}
if ($mode == "commentator") {
return $rank_commentator;
}
if ($mode == "photographer") {
return $rank_photographer;
}
}
3. File lang/english/main.php
before ?> add:
$lang['rank'] = "Rank:";
$lang['commentator'] = "commentator";
$lang['photographer'] = "photographer";
$lang['passive'] = "Passive ";
$lang['beginner'] = "Beginner ";
$lang['active'] = "Active ";
$lang['super'] = "Super ";
$lang['mega'] = "Mega ";
4. File details.php
Find:
$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".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:
$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, u.user_images".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:
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";
before this add:
$rank = "";
if ($comment_user_id != GUEST) {
$rank_commentator = get_rank($comment_row[$i][$user_table_fields['user_comments']], "commentator");
$rank_photographer = get_rank($comment_row[$i]['user_images'], "photographer");
$rank = $rank_commentator."<br />".$rank_photographer;
}
find:
$site_template->register_vars(array(
"comment_id" => $comment_row[$i]['comment_id'],
"comment_user_id" => $comment_user_id,
after add:
"rank" => $rank,
"lang_rank" => $lang['rank'],
5. File comment_bit.html
use
{if rank}
<b>{lang_rank}</b><br />
{rank}<br />
{endif rank}
6. File member.php
Find:
$del_img = $site_db->query($sql);
After add:
$sql2 = "UPDATE ".USERS_TABLE."
SET user_images = user_images-1
WHERE user_id = ".$image_row['user_id']."";
$site_db->query($sql2);
Find:
$image_id = $site_db->get_insert_id();
if ($result) {
After add:
if ($user_info['user_id'] != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET user_images = user_images+1
WHERE user_id = ".$user_info['user_id']."";
$site_db->query($sql);
}
find:
$site_template->register_vars(array(
"user_id" => $user_row['user_id'],
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
replace:
$rank_commentator = get_rank($user_row['user_comments'], "commentator");
$rank_photographer = get_rank($user_row['user_images'], "photographer");
$site_template->register_vars(array(
"user_id" => $user_row['user_id'],
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
"lang_rank" => $lang['rank'],
"rank_commentator" => $rank_commentator,
"rank_photographer" => $rank_photographer,
7. File member_profile.html
Use {rank_commentator} and {rank_photographer} and {lang_rank}
8. File admin/categories.php
2 times find:
$sql = "SELECT image_id
2 times replace:
$sql = "SELECT image_id, user_id
2 times find:
$image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id'];
2 times after add:
if ($image_row['user_id'] != GUEST) {
$sql2 = "UPDATE ".USERS_TABLE."
SET user_images = user_images-1
WHERE user_id = ".$image_row['user_id'];
$site_db->query($sql2);
}
9. File admin/images.php
Find:
$sql = "DELETE FROM ".IMAGES_TABLE."
WHERE image_id = ".$image_row['image_id'];
if ($site_db->query($sql)) {
After add:
if ($image_row['user_id'] != GUEST) {
$sql2 = "UPDATE ".USERS_TABLE."
SET user_images = user_images-1
WHERE user_id = ".$image_row['user_id'];
$site_db->query($sql2);
}
Find:
if ($result) {
$search_words = array();
foreach ($search_match_fields as $image_column => $match_column) {
if (isset($HTTP_POST_VARS[$image_column.'_'.$i])) {
$search_words[$image_column] = stripslashes($HTTP_POST_VARS[$image_column.'_'.$i]);
}
}
add_searchwords($image_id, $search_words);
After add:
if ($user_id != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET user_images = user_images+1
WHERE user_id = $user_id";
$site_db->query($sql);
}
10. File admin/validateimages.php
Find:
$search_words = array();
Before add:
if ($user_id != GUEST) {
$sql2 = "UPDATE ".USERS_TABLE."
SET user_images = user_images+1
WHERE user_id = $user_id";
$site_db->query($sql2);
}
11. File checkimages.php
Find:
$search_words = array();
Before add:
if ($user_id != GUEST) {
$sql = "UPDATE ".USERS_TABLE."
SET user_images = user_images+1
WHERE user_id = $user_id";
$site_db->query($sql);
}
12. Save this code as rank_install.php
<?php
define('ROOT_PATH', './');
include(ROOT_PATH.'config.php');
include(ROOT_PATH.'global.php');
$sql_data = "ALTER TABLE `".USERS_TABLE."` ADD `user_images` int(10) unsigned NOT NULL default '0' AFTER `user_comments`";
$site_db->query($sql_data);
$sql = "SELECT user_id, COUNT(image_id) AS count
FROM " . IMAGES_TABLE . "
GROUP BY user_id";
$result = $site_db->query($sql);
while($row = $site_db->fetch_array($result))
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_images = " . $row['count'] . "
WHERE user_id = " . $row['user_id'];
$site_db->query($sql);
}
?>
Done.
Install it and delete from server.
That's all!
-
спасибо, понравилось
-
Sorry, aber was macht die Modifikation genau?
Und ist die auch mit Starrating kompatibel?
-
Hallo allerseits,
besten Dank für diese MOD. :thumbup:
@Sumale.nin
Diese MOD vergibt den Benutzern einen Rang für die Anzahl ihrer Kommentare und die Anzahl ihrer hochgeladenen Fotos. Wenn du mit "Star Rating" diese MOD hier meinst: http://www.4homepages.de/forum/index.php?topic=923.msg3990#msg3990 ..., damit funktioniert es ohne Probleme.
Wer die MOD "Avatar 2.01" von v@no verwendet: http://www.4homepages.de/forum/index.php?topic=3978.msg16252#msg16252 sollte in Schritt 6 bei dem einfügen dieses Codes genau hinschauen und aufpassen.
$rank_commentator = get_rank($user_row['user_comments'], "commentator");
$rank_photographer = get_rank($user_row['user_images'], "photographer");
$site_template->register_vars(array(
"user_id" => $user_row['user_id'],
"user_name" => (isset($user_row['user_name'])) ? format_text($user_row['user_name'], 2) : REPLACE_EMPTY,
"lang_rank" => $lang['rank'],
"rank_commentator" => $rank_commentator,
"rank_photographer" => $rank_photographer,
Freundliche Grüße, Bommel
-
Hallo!
Ich habe versucht die Anzahl der Bilder und Kommentare über das ACP einstellbar zu machen, leider ohne erfolg. ich habe dazu in der setting tabelle mir vier neue werte eingetragen. aber leider bekomme ich das nicht im code der funktion.php berechnet. kann jemand da helfen?
-
It is possible rank user not a text but a picture - something like a military rank?