• [MOD]Users rank by quantity of comments and by quantity of photos 5 0 5 1
Currently:  

Author Topic: [MOD]Users rank by quantity of comments and by quantity of photos  (Read 33666 times)

0 Members and 1 Guest are viewing this topic.

Offline Lunat

  • Jr. Member
  • **
  • Posts: 53
    • View Profile
    • В объективе - МИР!
Hello all! The mod's creator is alekinna, 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 and this patches from V@no.

2. File includes/functions.php
before  ?> add:
Code: [Select]
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:
Code: [Select]
$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:
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".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:
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, 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:
Code: [Select]
$comment_user_ip = ($user_info['user_level'] == ADMIN) ? $comment_row[$i]['comment_ip'] : "";before this add:
Code: [Select]
$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:
Code: [Select]
$site_template->register_vars(array(
        "comment_id" => $comment_row[$i]['comment_id'],
        "comment_user_id" => $comment_user_id,

after add:
Code: [Select]
        "rank" => $rank,
        "lang_rank" => $lang['rank'],

5. File comment_bit.html
use
Code: [Select]
{if rank}
<b>{lang_rank}</b><br />
{rank}<br />
{endif rank}

6. File member.php
Find:
Code: [Select]
$del_img = $site_db->query($sql);After add:
Code: [Select]
$sql2 = "UPDATE ".USERS_TABLE."
          SET user_images = user_images-1
          WHERE user_id = ".$image_row['user_id']."";
  $site_db->query($sql2);

Find:
Code: [Select]
$image_id = $site_db->get_insert_id();
        if ($result) {
After add:
Code: [Select]
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:
Code: [Select]
  $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:
Code: [Select]
  $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:

Code: [Select]
$sql = "SELECT image_id2 times replace:
Code: [Select]
$sql = "SELECT image_id, user_id
2 times find:
Code: [Select]
$image_ids_sql .= (($image_ids_sql != "") ? ", " : "").$image_row['image_id'];2 times after add:
Code: [Select]
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:
Code: [Select]
$sql = "DELETE FROM ".IMAGES_TABLE."
            WHERE image_id = ".$image_row['image_id'];
    if ($site_db->query($sql)) {
After add:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
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:
Code: [Select]
$search_words = array();Before add:
Code: [Select]
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:
Code: [Select]
$search_words = array();Before add:
Code: [Select]
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
Code: [Select]
<?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!
« Last Edit: December 25, 2008, 05:48:08 PM by Lunat »

Offline Kaliha

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: [MOD]Users rank by quantity of comments and by quantity of photos
« Reply #1 on: October 03, 2009, 05:52:13 PM »
спасибо, понравилось
Sorry for my english, i use google translate )

Offline Benny Change

  • Addicted member
  • ******
  • Posts: 1.788
  • #WWG1WGA
    • View Profile
    • Qlobal-Change
Re: [MOD]Users rank by quantity of comments and by quantity of photos
« Reply #2 on: October 31, 2009, 10:24:04 AM »
Sorry, aber was macht die Modifikation genau?
Und ist die auch mit Starrating kompatibel?
Beste Grüße
Benny

Offline Bommel

  • Full Member
  • ***
  • Posts: 114
    • View Profile
Re: [MOD]Users rank by quantity of comments and by quantity of photos
« Reply #3 on: February 01, 2010, 05:07:29 PM »
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
Freundliche Grüße, Bommel

Nicht die Geduld mit mir verlieren, ich bin noch am Lernen./ Do not lose the patience with me, I am still in the learning. ;)

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD]Users rank by quantity of comments and by quantity of photos
« Reply #4 on: October 03, 2010, 12:24:14 PM »
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?

Offline szymonkot

  • Pre-Newbie
  • Posts: 6
    • View Profile
Re: [MOD]Users rank by quantity of comments and by quantity of photos
« Reply #5 on: June 24, 2011, 06:30:57 PM »
It is possible rank user not a text but a picture -  something like a military rank?