Advanced Reputation System

Started by Fustrate, March 25, 2008, 12:51:10 PM

Previous topic - Next topic

Privacy Blocked

#1080
why i can disagree smite
QuoteAn Error Has Occurred!
Please spread the love before giving it to this user again.
in other themes ? in permisiion i already Can -reputation other users

and how to user can't see the  people give the agree and disagree repurtation in other member?


thanks

The_Wii_Nes_Boy

Ok I still need help with this becaus ethe rep heart is still not showing and I can't even see it in the generated webpages source code! Any clues as to whats wrong wit it?

Privacy Blocked

Quote from: The_Wii_Nes_Boy on April 30, 2009, 03:13:25 AM
Ok I still need help with this becaus ethe rep heart is still not showing and I can't even see it in the generated webpages source code! Any clues as to whats wrong wit it?

upload images karma.gif to your themes/images

Fustrate

Quote from: The_Wii_Nes_Boy on April 30, 2009, 03:13:25 AM
Ok I still need help with this becaus ethe rep heart is still not showing and I can't even see it in the generated webpages source code! Any clues as to whats wrong wit it?
If it's not in the source, you need to do the edits to your theme's Display.template.php. Go here, choose your version, and click on install_display_template.xml and it'll give you a nicely formatted instructions screen.
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

#1084
All the relevent code is there, I've attached my Display.template for you to look at, it's the same thing as my last posts!!!!

@Fustrate: Like the avatar

Fustrate

Have you enabled reputation in the Admin area?

Heh, just finished Link's Awakening for the umpteenth time, so I decided to make a rotating avatar from it :)
Steven Hoffman
Former Team Member, 2009-2012

D0CT0R

As requested, here's my original stats.php file:

Quote<?php
/******************************************************************************
* Stats.php                                                                   *
*******************************************************************************
* SMF: Simple Machines Forum                                                  *
* Open-Source Project Inspired by Zef Hemel ([email protected])                *
* =========================================================================== *
* Software Version:           SMF 1.0 Beta 5 Public                           *
* Software by:                Simple Machines (http://www.simplemachines.org) *
* Copyright 2001-2004 by:     Lewis Media (hxxp:www.lewismedia.com [nonactive])         *
* Support, News, Updates at:  http://www.simplemachines.org                   *
*******************************************************************************
* This program is free software; you may redistribute it and/or modify it     *
* under the terms of the provided license as published by Lewis Media.        *
*                                                                             *
* This program is distributed in the hope that it is and will be useful,      *
* but WITHOUT ANY WARRANTIES; without even any implied warranty of            *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                        *
*                                                                             *
* See the "license.txt" file for details of the Simple Machines license.      *
* The latest version can always be found at http://www.simplemachines.org.    *
******************************************************************************/
if (!defined('SMF'))
   die('Hacking attempt...');

/*   This function has only one job: providing a display for forum statistics.
   As such, it has only one function:

   void DisplayStats()
      - gets all the statistics in order and puts them in.
      - uses the Stats template and language file. (and main sub template.)
      - requires the view_stats permission.
      - accessed from ?action=stats.
*/

// Display some useful/interesting board statistics.
function DisplayStats()
{
   global $txt, $months, $scripturl, $db_prefix, $modSettings, $user_info, $context;

   loadTemplate('Stats');
   loadLanguage('Stats');

   isAllowedTo('view_stats');

   // Build the link tree......
   $context['linktree'][] = array(
      'url' => $scripturl . '?action=stats',
      'name' => $txt['smf_stats_1']
   );
   $context['page_title'] = $context['forum_name'] . ' - ' . $txt['smf_stats_1'];

   // Get averages...
   $result = db_query("
      SELECT
         SUM(posts) AS posts, SUM(topics) AS topics, SUM(registers) AS registers,
         SUM(mostOn) AS mostOn, MIN(date) AS date
      FROM {$db_prefix}log_activity", __FILE__, __LINE__);
   $row = mysql_fetch_assoc($result);
   mysql_free_result($result);

   // This would be the amount of time the forum has been up... in days...
   $total_days_up = ceil((time() - strtotime($row['date'])) / (60 * 60 * 24));

   $context['average_posts'] = round($row['posts'] / $total_days_up, 2);
   $context['average_topics'] = round($row['topics'] / $total_days_up, 2);
   $context['average_members'] = round($row['registers'] / $total_days_up, 2);
   $context['average_online'] = round($row['mostOn'] / $total_days_up, 2);

   // How many users are online now.
   $result = db_query("
      SELECT COUNT(session)
      FROM {$db_prefix}log_online", __FILE__, __LINE__);
   list ($context['users_online']) = mysql_fetch_row($result);
   mysql_free_result($result);

   // Statistics such as number of boards, categories, etc.
   $result = db_query("
      SELECT COUNT(b.ID_BOARD) AS totalb
      FROM {$db_prefix}boards AS b", __FILE__, __LINE__);
   list ($context['num_boards']) = mysql_fetch_row($result);
   mysql_free_result($result);

   $result = db_query("
      SELECT COUNT(c.ID_CAT) AS totalc
      FROM {$db_prefix}categories AS c", __FILE__, __LINE__);
   list ($context['num_categories']) = mysql_fetch_row($result);
   mysql_free_result($result);

   $context['num_members'] = &$modSettings['memberCount'];
   $context['num_posts'] = &$modSettings['totalMessages'];
   $context['num_topics'] = &$modSettings['totalTopics'];
   $context['most_members_online'] = array(
      'number' => &$modSettings['mostOnline'],
      'date' => timeformat($modSettings['mostDate'])
   );
   $context['latest_member'] = array(
      'name' => $modSettings['latestRealName'],
      'id' => $modSettings['latestMember'],
      'href' => $scripturl . '?action=profile;u=' . $modSettings['latestMember'],
      'link' => '<a href="' . $scripturl . '?action=profile;u=' . $modSettings['latestMember'] . '"><b>' . $modSettings['latestRealName'] . '</b></a>'
   );

   // Poster top 10.
   $members_result = db_query("
      SELECT ID_MEMBER, realName, posts
      FROM {$db_prefix}members
      ORDER BY posts DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_posters'] = array();
   $max_num_posts = 1;
   while ($row_members = mysql_fetch_assoc($members_result))
   {
      $context['top_posters'][] = array(
         'name' => $row_members['realName'],
         'id' => $row_members['ID_MEMBER'],
         'num_posts' => $row_members['posts'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
      );

      if ($max_num_posts < $row_members['posts'])
         $max_num_posts = $row_members['posts'];
   }
   foreach ($context['top_posters'] as $i => $poster)
      $context['top_posters'][$i]['post_percent'] = round(($poster['num_posts'] * 100) / $max_num_posts);

   // Board top 10.
   $boards_result = db_query("
      SELECT ID_BOARD, name, numPosts
      FROM {$db_prefix}boards AS b
      WHERE $user_info[query_see_board]
      ORDER BY numPosts DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_boards'] = array();
   $max_num_posts = 1;
   while ($row_board = mysql_fetch_assoc($boards_result))
   {
      $context['top_boards'][] = array(
         'id' => $row_board['ID_BOARD'],
         'name' => $row_board['name'],
         'num_posts' => $row_board['numPosts'],
         'href' => $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0',
         'link' => '<a href="' . $scripturl . '?board=' . $row_board['ID_BOARD'] . '.0">' . $row_board['name'] . '</a>'
      );

      if ($max_num_posts < $row_board['numPosts'])
         $max_num_posts = $row_board['numPosts'];
   }
   foreach ($context['top_boards'] as $i => $board)
      $context['top_boards'][$i]['post_percent'] = round(($board['num_posts'] * 100) / $max_num_posts);

   // Topic replies top 10.
   // !!!SLOW This query is slow, but can it be fixed at all?
   $topic_reply_result = db_query("
      SELECT m.subject, t.numReplies, hxxp:t.id [nonactive]_BOARD, hxxp:t.id [nonactive]_TOPIC, hxxp:b.name [nonactive]
      FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}boards AS b
      WHERE hxxp:m.id [nonactive]_MSG = hxxp:t.id [nonactive]_FIRST_MSG
         AND $user_info[query_see_board]
         AND hxxp:t.id [nonactive]_BOARD = hxxp:b.id [nonactive]_BOARD
      ORDER BY t.numReplies DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_topics_replies'] = array();
   $max_num_replies = 1;
   while ($row_topic_reply = mysql_fetch_assoc($topic_reply_result))
   {
      censorText($row_topic_reply['subject']);

      $context['top_topics_replies'][] = array(
         'id' => $row_topic_reply['ID_TOPIC'],
         'board' => array(
            'id' => $row_topic_reply['ID_BOARD'],
            'name' => $row_topic_reply['name'],
            'href' => $scripturl . '?board=' . $row_topic_reply['ID_BOARD'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row_topic_reply['ID_BOARD'] . '.0">' . $row_topic_reply['name'] . '</a>'
         ),
         'subject' => $row_topic_reply['subject'],
         'num_replies' => $row_topic_reply['numReplies'],
         'href' => $scripturl . '?topic=' . $row_topic_reply['ID_TOPIC'] . '.0',
         'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_reply['ID_TOPIC'] . '.0">' . $row_topic_reply['subject'] . '</a>'
      );

      if ($max_num_replies < $row_topic_reply['numReplies'])
         $max_num_replies = $row_topic_reply['numReplies'];
   }
   foreach ($context['top_topics_replies'] as $i => $topic)
      $context['top_topics_replies'][$i]['post_percent'] = round(($topic['num_replies'] * 100) / $max_num_replies);

   // Topic views top 10.
   $topic_view_result = db_query("
      SELECT m.subject, t.numViews, hxxp:t.id [nonactive]_BOARD, hxxp:t.id [nonactive]_TOPIC, hxxp:b.name [nonactive]
      FROM {$db_prefix}topics AS t, {$db_prefix}messages AS m, {$db_prefix}boards AS b
      WHERE hxxp:m.id [nonactive]_MSG = hxxp:t.id [nonactive]_FIRST_MSG
         AND $user_info[query_see_board]
         AND hxxp:t.id [nonactive]_BOARD = hxxp:b.id [nonactive]_BOARD
      ORDER BY t.numViews DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_topics_views'] = array();
   $max_num_views = 1;
   while ($row_topic_views = mysql_fetch_assoc($topic_view_result))
   {
      censorText($row_topic_views['subject']);

      $context['top_topics_views'][] = array(
         'id' => $row_topic_views['ID_TOPIC'],
         'board' => array(
            'id' => $row_topic_views['ID_BOARD'],
            'name' => $row_topic_views['name'],
            'href' => $scripturl . '?board=' . $row_topic_views['ID_BOARD'] . '.0',
            'link' => '<a href="' . $scripturl . '?board=' . $row_topic_views['ID_BOARD'] . '.0">' . $row_topic_views['name'] . '</a>'
         ),
         'subject' => $row_topic_views['subject'],
         'num_views' => $row_topic_views['numViews'],
         'href' => $scripturl . '?topic=' . $row_topic_views['ID_TOPIC'] . '.0',
         'link' => '<a href="' . $scripturl . '?topic=' . $row_topic_views['ID_TOPIC'] . '.0">' . $row_topic_views['subject'] . '</a>'
      );

      if ($max_num_views < $row_topic_views['numViews'])
         $max_num_views = $row_topic_views['numViews'];
   }
   foreach ($context['top_topics_views'] as $i => $topic)
      $context['top_topics_views'][$i]['post_percent'] = round(($topic['num_views'] * 100) / $max_num_views);

   // Poster top 10.
   $members_result = db_query("
      SELECT hxxp:t.id [nonactive]_MEMBER_STARTED, COUNT(t.ID_TOPIC) AS hits, mem.realName
      FROM {$db_prefix}topics AS t, {$db_prefix}members AS mem
      WHERE hxxp:t.id [nonactive]_MEMBER_STARTED = hxxp:mem.id [nonactive]_MEMBER
      GROUP BY hxxp:t.id [nonactive]_MEMBER_STARTED
      ORDER BY hits DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_starters'] = array();
   $max_num_topics = 1;
   while ($row_members = mysql_fetch_assoc($members_result))
   {
      $context['top_starters'][] = array(
         'name' => $row_members['realName'],
         'id' => $row_members['ID_MEMBER_STARTED'],
         'num_topics' => $row_members['hits'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER_STARTED'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER_STARTED'] . '">' . $row_members['realName'] . '</a>'
      );

      if ($max_num_topics < $row_members['hits'])
         $max_num_topics = $row_members['hits'];
   }
   foreach ($context['top_starters'] as $i => $topic)
      $context['top_starters'][$i]['post_percent'] = round(($topic['num_topics'] * 100) / $max_num_topics);

   // Time online top 10.
   // !!!SLOW This query is sorta slow.  Should we just add a key? (or would that be bad in the long run?)
   $members_result = db_query("
      SELECT ID_MEMBER, realName, totalTimeLoggedIn
      FROM {$db_prefix}members
      ORDER BY totalTimeLoggedIn DESC
      LIMIT 10", __FILE__, __LINE__);
   $context['top_time_online'] = array();
   $max_time_online = 1;
   while ($row_members = mysql_fetch_assoc($members_result))
   {
      // Figure out the days, hours and minutes.
      $timeDays = floor($row_members['totalTimeLoggedIn'] / 86400);
      $timeHours = floor(($row_members['totalTimeLoggedIn'] % 86400) / 3600);

      // Figure out which things to show... (days, hours, minutes, etc.)
      $timelogged = '';
      if ($timeDays > 0)
         $timelogged .= $timeDays . $txt['totalTimeLogged5'];
      if ($timeHours > 0)
         $timelogged .= $timeHours . $txt['totalTimeLogged6'];
      $timelogged .= floor(($row_members['totalTimeLoggedIn'] % 3600) / 60) . $txt['totalTimeLogged7'];

      $context['top_time_online'][] = array(
         'id' => $row_members['ID_MEMBER'],
         'name' => $row_members['realName'],
         'time_online' => $timelogged,
         'seconds_online' => $row_members['totalTimeLoggedIn'],
         'href' => $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'],
         'link' => '<a href="' . $scripturl . '?action=profile;u=' . $row_members['ID_MEMBER'] . '">' . $row_members['realName'] . '</a>'
      );

      if ($max_time_online < $row_members['totalTimeLoggedIn'])
         $max_time_online = $row_members['totalTimeLoggedIn'];
   }
   foreach ($context['top_time_online'] as $i => $member)
      $context['top_time_online'][$i]['time_percent'] = round(($member['seconds_online'] * 100) / $max_time_online);

   // Activity by day.
   $days_result = db_query("
      SELECT date, topics, posts, registers, mostOn, hits
      FROM {$db_prefix}log_activity
      ORDER BY date DESC
      LIMIT 30", __FILE__, __LINE__);
   $context['daily'] = array();
   while ($row_days = mysql_fetch_assoc($days_result))
      $context['daily'][] = array(
         'date' => array(
            'month' => substr($row_days['date'], 5, 2),
            'day' => substr($row_days['date'], 8),
            'year' => substr($row_days['date'], 0, 4),
         ),
         'month' => $months[(int) substr($row_days['date'], 5, 2)],
         'new_topics' => $row_days['topics'],
         'new_posts' => $row_days['posts'],
         'new_members' => $row_days['registers'],
         'most_members_online' => $row_days['mostOn'],
         'hits' => $row_days['hits']
      );

   // Activity by month.
   $months_result = db_query("
      SELECT date,
         SUM(hits) AS hits, SUM(registers) AS registers, SUM(topics) AS topics, SUM(posts) AS posts,
         MAX(mostOn) AS mostOn
      FROM {$db_prefix}log_activity
      GROUP BY YEAR(date), MONTH(date)", __FILE__, __LINE__);
   $context['monthly'] = array();
   while ($row_months = mysql_fetch_assoc($months_result))
      $context['monthly'][$row_months['date']] = array(
         'date' => array(
            'month' => substr($row_months['date'], 5, 2),
            'day' => substr($row_months['date'], 8),
            'year' => substr($row_months['date'], 0, 4),
         ),
         'month' => $months[(int) substr($row_months['date'], 5, 2)],
         'new_topics' => $row_months['topics'],
         'new_posts' => $row_months['posts'],
         'new_members' => $row_months['registers'],
         'most_members_online' => $row_months['mostOn'],
         'hits' => $row_months['hits']
      );

   // This gets rid of the filesort on the query ;).
   krsort($context['monthly']);

   $context['show_member_list'] = allowedTo('view_mlist');
}

?>

Fustrate

Err, that doesn't preserve tabs vs. spaces, so you need to download it to your computer and then, when you're posting, press "Additional Options" and you'll see an upload box.
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

Quote from: Fustrate on May 01, 2009, 03:40:25 AM
Have you enabled reputation in the Admin area?

Heh, just finished Link's Awakening for the umpteenth time, so I decided to make a rotating avatar from it :)

Reputition is enables in the admin area, all permissions are correct. Whats the next ting besides the Display.temp that would cause this kind of problem?

Yeah, the link series is one of my all time favorite (next to Final Fantasy series), hence my own animated avatar and sig set.

Privacy Blocked

answer please my question  ???

Quoteand how to user can't see the  people give the agree and disagree repurtation in other member?

thanks

Fustrate

Quote from: Privacy Blocked on May 02, 2009, 01:36:39 AM
answer please my question  ???

Quoteand how to user can't see the  people give the agree and disagree repurtation in other member?

thanks

Right now it's just set up to allow you to see your own, as far as I know. I'll look into what you need to do to allow everyone to see it.

Quote from: The_Wii_Nes_Boy on May 01, 2009, 12:21:40 PM
Quote from: Fustrate on May 01, 2009, 03:40:25 AM
Have you enabled reputation in the Admin area?

Heh, just finished Link's Awakening for the umpteenth time, so I decided to make a rotating avatar from it :)

Reputition is enables in the admin area, all permissions are correct. Whats the next ting besides the Display.temp that would cause this kind of problem?

Yeah, the link series is one of my all time favorite (next to Final Fantasy series), hence my own animated avatar and sig set.

Could you upload a screenshot of your Reputation settings page?
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

Find attached screen shot of Reputation settings, just to make sure I'm not a complete retard obviously, lol  :P

Fustrate

Hmm... nothing wrong there, but I noticed one of the text strings isn't the same as in the current version. Are you using v1.7.4?
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

Forums are 1.1.8
Advanced Reputation is 1.7.4

Nice to know I passed the retard test :D, Is this text string causing the problems?

Fustrate

Nah, I think the text string is my fault somewhere

So... can you see anything reputation-related anywhere?
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

#1095
Find attached a pic of post are, I can give you a list of all the mods that are on my site if you think it will help.

Fustrate

I registered as RepSys - could you edit my profile to give me 10 posts (so I can actually test it out)?
Steven Hoffman
Former Team Member, 2009-2012

The_Wii_Nes_Boy

It's done, profile is edited to reflect 10 posts . An information for me?

Tacheon

This is an excellent mod, even though I had to do everything by hand.  A few questions, however.

I am using 1.1.8.

I received the error:
Unknown column 'k.message' in 'field list'
File: /mounted-storage/home119a/sub005/sc66957-EQTO/forum/Sources/Display.php
Line: 740


in my Display.php, and after trying to rectify it for quite some time, I reverted the code back to the original, with no negative side effects in terms of the mod (or so it seems).  Is this code for a previous version of SMF, or does it serve some other purpose that I need it for?

Also, does the reputation system support decimal values (e.g. ".25 rep/post"), or do I need to work around that?  An answer would be appreciated, but my all means, take your time.

Seriously though, I can't even imagine how much time and effort went into making this modification, I tip my hat to you.

Fustrate

The_Wii_Nes_Boy: did the edits get made for /Sources/Display.php and Subs.php and Load.php? You might want to go step-by-step through http://www.fustrate.com/dev/sources/Advanced%20Reputation%20System/Reputation_1-1-x/package-info.xml and make sure everything was done correctly. Sorry for the late response, there was a massive spike in stuff I had to attend to the past two days.

Tacheon: Did you remember to do the database edits, too? message is a new column that should've been added when you upload install.php to your forum's root directory and ran it in your browser.
Steven Hoffman
Former Team Member, 2009-2012

Advertisement: