News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Advanced Reputation System

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

Previous topic - Next topic

Sudhakar Arjunan

I have this mod working good in my default theme.

Showup all images and it shows reputation images as well as no as 2.

But in my custom theme, it does not show the images even i have added the images inside the custom theme images folder.

And the same profile reputation power shows here like 100 ect, but inside my default theme as 2 for the same profile.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

lepard

When people go to their profile to view their reputation, they can't see beyond the first page of records, What am I doing wrong?
Rick Lepard

Careful of the simple police

Fustrate

there's a fix for that further back in this thread, maybe on the page before this. When I first wrote that part, I wasn't thinking straight and didn't include pagination, but that'll be all fixed in the next version.

asudhakar: if you look at the page source, where does it show the images as coming from? Do they point to a valid location?
Steven Hoffman
Former Team Member, 2009-2012

Sudhakar Arjunan

Quote from: YodaOfSpookness on October 28, 2008, 03:31:43 AM
asudhakar: if you look at the page source, where does it show the images as coming from? Do they point to a valid location?

For default theme, its taking and showing properly from the valid default location.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

thekid65

We've noticed that the pop-up box to enter rep and rep comments disappears after approx 25 seconds, is this normal, and is this setting adjustable?

Fustrate

Yes, it's programmed to disappear after 30 seconds. To change it, go into /themes/(your theme or default)/scripts/script.js and find
var disappeardelay = 30000;  // karma box hide display time, in milliseconds
and change it to however many seconds you want it to use, followed by 000

A.SK, not your default theme, your custom theme. Where is it trying to display the image from?
Steven Hoffman
Former Team Member, 2009-2012

thekid65

Quote from: YodaOfDarkness on November 02, 2008, 11:24:55 AM
Yes, it's programmed to disappear after 30 seconds. To change it, go into /themes/(your theme or default)/scripts/script.js and find
var disappeardelay = 30000;  // karma box hide display time, in milliseconds
and change it to however many seconds you want it to use, followed by 000


That did the trick, thank you.

Sudhakar Arjunan

Quote from: YodaOfDarkness on November 02, 2008, 11:24:55 AM
A.SK, not your default theme, your custom theme. Where is it trying to display the image from?

Really sorry, i dont understand it.

The theme am using is Energy.

Its not showing any image at any post or profile.

But it works and shows image when am at default theme.

Link to my forum : http://discuss.itacumens.com
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Fustrate

Steven Hoffman
Former Team Member, 2009-2012

Sudhakar Arjunan

Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

glennk

Hi There,

This looks great and Im sure my forum members will love it. Am I right in thinking that when you give rep and add a comment that the comment should appear in the persons post you are agreeing with ??

If this is the case the comments Im giving arent showing up.

These are the errors in the log

http://www.whitbyseaanglers.co.uk/forum/index.php?pretty;board=north-east-coast-fishing;topic=forum-downtime.0&action=reputation;uid=569;m=58240;sesc

2: mysql_free_result(): supplied argument is not a valid MySQL result resource

File: /home/glennk/public_html/forum/Sources/Karma.php
Line: 510

----------------------------------------------

8: Undefined index: sa
Apply Filter: Only show the errors from this file
File: /home/glennk/public_html/forum/Sources/Karma.php
Line: 225

------------------------------------------------

: Undefined index: uid
Apply Filter: Only show the errors from this file
File: /home/glennk/public_html/forum/Sources/Karma.php
Line: 233

Fustrate

The second and third errors aren't critical, but attach your Karma.php file and I'll take a look at the first one.
Steven Hoffman
Former Team Member, 2009-2012

glennk

thanks,

Not sure how to attach a file here though ?

these are lines 508-510

// Load the membergroups allowed, and check permissions.
      $board_groups = $board['member_groups'] == '' ? array() : explode(',', $board['member_groups']);
      $smcFunc['db_free_result']($request);


Quote<?php
/**********************************************************************************
* Karma.php                                                                       *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 2.0 Beta 4                                      *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006-2008 by:     Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* 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 Simple Machines LLC.          *
*                                                                                 *
* 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 file contains one humble function, which applauds or smites a user.

   void ModifyKarma()
      - gives or takes karma from a user.
      - redirects back to the referrer afterward, whether by javascript or
        the passed parameters.
      - requires the karma_edit permission, and that the user isn't a guest.
      - depends on the karmaMode, karmaWaitTime, and karmaTimeRestrictAdmins
        settings.
      - is accessed via ?action=modifykarma.
*/

/******************* Disabled by Advanced Reputation System **********************
**********************************************************************************
// Modify a user's karma the old and disgusting way...
function ModifyKarma_old()
{
   global $modSettings, $txt, $user_info, $topic, $smcFunc;

   // If the mod is disabled, show an error.
   if (empty($modSettings['karmaMode']))
      fatal_lang_error('feature_disabled', true);

   // If you're a guest or can't do this, blow you off...
   is_not_guest();
   isAllowedTo('karma_edit');

   checkSession('get');

   // If you don't have enough posts, tough luck.
   // !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
   if ($user_info['posts'] < $modSettings['karmaMinPosts'])
      fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));

   // And you can't modify your own, punk! (use the profile if you need to.)
   if (empty($_REQUEST['uid']) || (int) $_REQUEST['uid'] == $user_info['id'])
      fatal_lang_error('cant_change_own_karma', false);

   // The user ID _must_ be a number, no matter what.
   $_REQUEST['uid'] = (int) $_REQUEST['uid'];

   // Applauding or smiting?
   $dir = $_REQUEST['sa'] != 'applaud' ? -1 : 1;

   // Delete any older items from the log. (karmaWaitTime is by hour.)
   $smcFunc['db_query']('', '
      DELETE FROM {db_prefix}log_karma
      WHERE {int:current_time} - log_time > {int:wait_time}',
      array(
         'wait_time' => (int) ($modSettings['karmaWaitTime'] * 3600),
         'current_time' => time(),
      )
   );

   // Start off with no change in karma.
   $action = 0;

   // Not an administrator... or one who is restricted as well.
   if (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum'))
   {
      // Find out if this user has done this recently...
      $request = $smcFunc['db_query']('', '
         SELECT action
         FROM {db_prefix}log_karma
         WHERE id_target = {int:id_target}
            AND id_executor = {int:current_member}
         LIMIT 1',
         array(
            'current_member' => $user_info['id'],
            'id_target' => $_REQUEST['uid'],
         )
      );
      if ($smcFunc['db_num_rows']($request) > 0)
         list ($action) = $smcFunc['db_fetch_row']($request);
      $smcFunc['db_free_result']($request);
   }

   // They haven't, not before now, anyhow.
   if (empty($action) || empty($modSettings['karmaWaitTime']))
   {
      // Put it in the log.
      $smcFunc['db_insert']('replace',
            '{db_prefix}log_karma',
            array('action' => 'int', 'id_target' => 'int', 'id_executor' => 'int', 'log_time' => 'int'),
            array($dir, $_REQUEST['uid'], $user_info['id'], time()),
            array('id_target', 'id_executor')
         );

      // Change by one.
      updateMemberData($_REQUEST['uid'], array($dir == 1 ? 'karma_good' : 'karma_bad' => '+'));
   }
   else
   {
      // If you are gonna try to repeat.... don't allow it.
      if ($action == $dir)
         fatal_lang_error('karma_wait_time', false, array($modSettings['karmaWaitTime'], $txt['hours']));

      // You decided to go back on your previous choice?
      $smcFunc['db_query']('', '
         UPDATE {db_prefix}log_karma
         SET action = {int:action}, log_time = {int:current_time}
         WHERE id_target = {int:id_target}
            AND id_executor = {int:current_member}',
         array(
            'current_member' => $user_info['id'],
            'action' => $dir,
            'current_time' => time(),
            'id_target' => $_REQUEST['uid'],
         )
      );

      // It was recently changed the OTHER way... so... reverse it!
      if ($dir == 1)
         updateMemberData($_REQUEST['uid'], array('karma_good' => '+', 'karma_bad' => '-'));
      else
         updateMemberData($_REQUEST['uid'], array('karma_bad' => '+', 'karma_good' => '-'));
   }

   // Figure out where to go back to.... the topic?
   if (!empty($topic))
      redirectexit('topic=' . $topic . '.' . $_REQUEST['start'] . '#msg' . (int) $_REQUEST['m']);
   // Hrm... maybe a personal message?
   elseif (isset($_REQUEST['f']))
      redirectexit('action=pm;f=' . $_REQUEST['f'] . ';start=' . $_REQUEST['start'] . (isset($_REQUEST['l']) ? ';l=' . (int) $_REQUEST['l'] : '') . (isset($_REQUEST['pm']) ? '#' . (int) $_REQUEST['pm'] : ''));
   // JavaScript as a last resort.
   else
   {
      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>...</title>
      <script language="JavaScript" type="text/javascript"><!-- // --><![CDATA[
         history.go(-1);
      // ]]></script>
   </head>
   <body>&laquo;</body>
</html>';

      obExit(false);
   }
}
**********************************************************************************
******************** Disabled by Advanced Reputation System *********************/

// What's this?  I dunno, what are you talking about?  Never seen this before, nope.  No siree.
function BookOfUnknown()
{
   global $context;

   if (strpos($_GET['action'], 'mozilla') !== false && !$context['browser']['is_gecko'])
      redirectexit('http://www.getfirefox.com/');
   elseif (strpos($_GET['action'], 'mozilla') !== false)
      redirectexit('about:mozilla');

   echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>The Book of Unknown, ', @$_GET['verse'] == '2:18' ? '2:18' : '4:16', '</title>
      <style type="text/css">
         em
         {
            font-size: 1.3em;
            line-height: 0;
         }
      </style>
   </head>
   <body style="background-color: #444455; color: white; font-style: italic; font-family: serif;">
      <div style="margin-top: 12%; font-size: 1.1em; line-height: 1.4; text-align: center;">';
   if (@$_GET['verse'] == '2:18')
      echo '
         Woe, it was that his name wasn\'t <em>known</em>, that he came in mystery, and was recognized by none.&nbsp;And it became to be in those days <em>something</em>.&nbsp; Something not yet <em id="unknown" name="[Unknown]">unknown</em> to mankind.&nbsp; And thus what was to be known the <em>secret project</em> began into its existence.&nbsp; Henceforth the opposition was only <em>weary</em> and <em>fearful</em>, for now their match was at arms against them.';
   else
      echo '
         And it came to pass that the <em>unbelievers</em> dwindled in number and saw rise of many <em>proselytizers</em>, and the opposition found fear in the face of the <em>x</em> and the <em>j</em> while those who stood with the <em>something</em> grew stronger and came together.&nbsp; Still, this was only the <em>beginning</em>, and what lay in the future was <em id="unknown" name="[Unknown]">unknown</em> to all, even those on the right side.';
   echo '
      </div>
      <div style="margin-top: 2ex; font-size: 2em; text-align: right;">';
   if (@$_GET['verse'] == '2:18')
      echo '
         from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 2:18</span>';
   else
      echo '
         from <span style="font-family: Georgia, serif;"><strong><a href="http://www.unknownbrackets.com/about:unknown" style="color: white; text-decoration: none; cursor: text;">The Book of Unknown</a></strong>, 4:16</span>';
   echo '
      </div>
   </body>
</html>';

   obExit(false);
}

// Modify a user's karma, only better than the old one!
function ModifyKarma()
{
   global $modSettings, $txt, $user_info, $smcFunc;

   // A fix for templates that don't get edited correctly, and still show the old links.
   if($_GET['sa'] == 'applaud' || $_GET['sa'] == 'smite')
      redirectexit('action=reputation;uid=', $_GET['uid'], ';m=', $_GET['m'], ';topic=', $_GET['topic'], ';sesc=', $_GET['sesc'], '');

   // If the mod is disabled, show an error.
   if (empty($modSettings['karmaMode']))
      fatal_lang_error('feature_disabled', true);

   // The user ID _must_ be a number, no matter what.
   $uid = (int) $_POST['uid'];

   // If you're a guest or can't do this, blow you off...
   is_not_guest();
   isAllowedTo('karma_edit');

   checkSession('request');

   // If you don't have enough posts, tough luck.
   // !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
   if ($user_info['posts'] < $modSettings['karmaMinPosts'])
      fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));

   // And you can't modify your own, punk! (use the profile if you need to.)
   if (empty($uid) || $uid == $user_info['id'])
      fatal_lang_error('cant_change_own_karma', false);

   // Find their (super)power (and their secret identity)! Can't go into negatives...
   $points = $user_info['karma_good'] - $user_info['karma_bad'];
   $power = ($points - ($points % $modSettings['karmaBarPower'])) / $modSettings['karmaBarPower'];
   $power = (int) (($power > 0) ? $power : 0);

   // Has to be an int
   $message_id = (int) $_POST['m'];
   $topic_id = (int) $_POST['topic'];

   // Should use a modSetting for 300?
   $comment = (strlen($_POST['reputation_comment']) > 300) ? substr($_POST['reputation_comment'], 0, 300) : $_POST['reputation_comment'];
   
   // I fart in your general direction!
   if (strtolower($comment) == 'your mother was a hamster and your father smelt of elderberries!')
      fatal_error('...and Saint Attila raised the hand grenade up on high, saying, "O Lord, bless this Thy hand grenade that with it Thou mayest blow Thine enemies to tiny bits, in Thy mercy." And the Lord did grin and the people did feast upon the lambs and sloths and carp and anchovies and orangutans and breakfast cereals, and fruit bats and large chu... *ahem* And the Lord spake, saying, "First shalt thou take out the Holy Pin, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy foe, who being naughty in my sight, shall snuff it." Amen.', false);

   //Find the time 24 hours ago... but wait... what if karmaWaitTime is greater than 24?! Bad var name, but who gives a hoot, if it works?
   $yesterday = time() - 86400;
   $longtimeago = time() - (60 * 60 * ($modSettings['karmaWaitTime']));
   $hoursAgo = ($modSettings['karmaWaitTime'] < 24) ? $yesterday : $longtimeago;

   // Applauding or smiting? Don't try to do a cheap javascript injection on me...
   switch ($_POST['type']) {
      case 'agree':
         if(!allowedTo('positive_karma'))
            fatal_lang_error('karma_cant_agree', false);
         $karma_which = 'karma_good';
         break;
      case 'disagree':
         if(!allowedTo('negative_karma'))
            fatal_lang_error('karma_cant_disagree', false);
         $karma_which = 'karma_bad';
         break;
      default:
         // Should never get here
         fatal_lang_error('karma_choose_action', false);
   }

   // Going in order of permissions... it only gets added if it passes all of the tests!

   // Used up all of their $modSettings['karmaMaxPerDay'] ?
   if (!empty($modSettings['karmaMaxPerDay']) && ($modSettings['karmaMaxPerDay'] > 0))
   {
      // Find out if this user has done this in the past 24 hours.
      $request = $smcFunc['db_query']('', '
         SELECT log_time
         FROM {db_prefix}log_karma
         WHERE id_executor = {int:current_member}
            AND log_time >= {int:yesterday}
         LIMIT 1',
         array(
            'current_member' => $user_info['id'],
            'yesterday' => $hoursAgo,
         )
      );
      if ($smcFunc['db_num_rows']($request) >= $modSettings['karmaMaxPerDay']){ // but why would they be over?
         $smcFunc['db_free_result']($request);
         fatal_lang_error('karma_maxed_out', false, array($modSettings['karmaMaxPerday']));
      }

      // They're good on this one :) Continue on to the next test!
      $smcFunc['db_free_result']($request);
   }

   // Haven't waited long enough?
   if (!empty($modSettings['karmaWaitTime']) && (!empty($modSettings['karmaTimeRestrictAdmins']) || !allowedTo('moderate_forum')) && $modSettings['karmaWaitTime'] > 0)
   {
      // Find out if this user has done this in the past $longenough.
      $request = $smcFunc['db_query']('', '
         SELECT log_time
         FROM {db_prefix}log_karma
         WHERE id_executor = {int:current_member}
            AND log_time >= {int:waittime}
         LIMIT 1',
         array(
            'current_member' => $user_info['id'],
            'waittime' => $longtimeago,
         )
      );
      if ($smcFunc['db_num_rows']($request) > 0){
         // Give them approximate minutes until they can, to be nice ;)
         list ($log_time) = $smcFunc['db_fetch_row']($request);
         $log_time_wait = ($log_time + (60 * 60 * $modSettings['karmaWaitTime'])) - time(); // seconds
         $log_time_wait = ($log_time_wait - ($log_time_wait % 60)) / 60; // minutes
         $smcFunc['db_free_result']($request);
         fatal_lang_error('karma_please_wait', false, array($modSettings['karmaWaitTime'], $log_time_wait));
      }

      // They're good on this one :) Continue on to the next test!
      $smcFunc['db_free_result']($request);
   }

   // Need to spread it around a bit? No, not the flu, silly!
   if (!empty($modSettings['karmaSpreadAround']) && ($modSettings['karmaSpreadAround'] > 0))
   {
      // Grab the latest karmaSpreadAround actions - if the target is in there, throw an error!
      $request = $smcFunc['db_query']('', '
         SELECT id_target
         FROM {db_prefix}log_karma
         WHERE id_executor = {int:current_member}
         ORDER BY log_time DESC
         LIMIT {int:spread}',
         array(
            'current_member' => $user_info['id'],
            'spread' => $modSettings['karmaSpreadAround'],
         )
      );
      if ($smcFunc['db_num_rows']($request) > 0)
         while($row = $smcFunc['db_fetch_assoc']($request))
            if($row['id_target'] == $uid)
               fatal_lang_error('karma_spread_around', false);

      // They're good on this one :) Continue on to the next test!
      $smcFunc['db_free_result']($request);
   }

   // One last test - have they already sent rep to this particular post?
   $request = $smcFunc['db_query']('', '
      SELECT log_time
      FROM {db_prefix}log_karma
      WHERE id_executor = {int:executor}
         AND message = {string:message}
      LIMIT 1',
      array(
         'executor' => $user_info['id'],
         'message' => $message_id
      )
   );
   $alreadySent = $smcFunc['db_num_rows']($request) != 0;
   $smcFunc['db_free_result']($request);

   if($alreadySent)
      fatal_lang_error('karma_sent_twice', false);

   // Finally! Now do an update

   if($karma_which == 'karma_good')
      $request = $smcFunc['db_query']('', '
         UPDATE {db_prefix}members
         SET karma_good = karma_good + {int:power}
         WHERE id_member = {int:uid}',
         array(
            'power' => $power,
            'uid' => $uid,
         )
      );
   else
      $request = $smcFunc['db_query']('', '
         UPDATE {db_prefix}members
         SET karma_bad = karma_bad + {int:power}
         WHERE id_member = {int:uid}',
         array(
            'power' => $power,
            'uid' => $uid,
         )
      );

   if(!$request)
      fatal_lang_error('karma_didnt_update', false);

   $action_type = ($power != 0) ? $karma_which : 'karma_disabled';

   $request = $smcFunc['db_query']('', '
      SELECT subject
      FROM {db_prefix}messages
      WHERE id_msg = {int:id_message}
      LIMIT 1',
      array(
         'id_message' => $message_id,
      )
   );
   list ($title) = $smcFunc['db_fetch_row']($request);
   $smcFunc['db_free_result']($request);

   // Log this new action!
   $smcFunc['db_insert']('replace',
      '{db_prefix}log_karma',
      array('action' => 'int', 'id_target' => 'int', 'id_executor' => 'int', 'log_time' => 'int', 'comment' => 'string', 'action_type' => 'string', 'message' => 'int', 'topic' => 'int', 'title' => 'string'),
      array($power, $uid, $user_info['id'], time(), $comment, $action_type, $message_id, $topic_id, $title),
      array('id_target', 'id_executor')
   );

   // Figure out where to go back to.... the topic?
   if (isset($_POST['topic']))
      redirectexit('topic=' . $_POST['topic'] . '#msg' . $_POST['m']);
   // Hrm... maybe a personal message?
   elseif (isset($_POST['f']))
      redirectexit('action=pm;f=' . $_POST['f'] . ';start=' . $_POST['start'] . (isset($_POST['l']) ? ';l=' . $_POST['l'] : '') . (isset($_POST['pm']) ? '#' . $_POST['pm'] : ''));
   // JavaScript as a last resort.
   else
   {
      echo '
<html>
   <head>
      <title>...</title>
      <script language="JavaScript" type="text/javascript"><!-- // -->
         history.go(-1);
      </script>
   </head>
   <body>&laquo;</body>
</html>';

      obExit(false);
   }
}

// For those poor souls without javascript support :(
function SendKarma()
{
   global $modSettings, $user_info, $context, $smcFunc, $txt;

   // If the mod is disabled, show an error.
   if (empty($modSettings['karmaMode']))
      fatal_lang_error('feature_disabled', true);

   // If you're a guest or can't do this, blow you off...
   is_not_guest();
   isAllowedTo('karma_edit');
   checkSession('request');

   // These _must_ be a number, no matter what.
   $uid = (int) $_GET['uid'];
   $message = (int) $_GET['m'];
   $topic = (int) $_GET['topic'];

   // You can't modify your own, punk! (use the profile if you need to.)
   if (empty($uid) || $uid == $user_info['id'])
      fatal_lang_error('cant_change_own_karma', false);

   // If you don't have enough posts, tough luck.
   // !!! Should this be dropped in favor of post group permissions?  Should this apply to the member you are smiting/applauding?
   if ($user_info['posts'] < $modSettings['karmaMinPosts'])
      fatal_lang_error('not_enough_posts_karma', true, array($modSettings['karmaMinPosts']));

   $message_request = $smcFunc['db_query']('', '
      SELECT *
      FROM {db_prefix}messages
      WHERE id_msg = {int:message}
      LIMIT 1',
      array(
         'message' => $message,
      )
   );

   while($row = $smcFunc['db_fetch_assoc']($message_request)){
      $context['message'] = $row;

      $board_request = $smcFunc['db_query']('', '
         SELECT *
         FROM {db_prefix}boards
         WHERE id_board = {int:board}',
         array(
            'board' => $context['message']['id_board']
         )
      );

      $board = $smcFunc['db_fetch_assoc']($board_request);

      // Load the membergroups allowed, and check permissions.
      $board_groups = $board['member_groups'] == '' ? array() : explode(',', $board['member_groups']);
      $smcFunc['db_free_result']($request);

      // Kick 'em out if they don't have permission to view this topic!
      if (count(array_intersect($user_info['groups'], $board_groups)) == 0 && !$user_info['is_admin'])
         fatal_lang_error('topic_gone', false);

      // Put it in quote tags to make it stand out a little... and because it's a quote.
      $context['message']['body'] = "
Quote from: {$context['message'['poster_name']} link=topic={$context['message']['id_topic']}.msg{$context['message']['id_msg']}#msg{$context['message']['id_msg']} date={$context['message']['poster_time']}]{$context['message']['body']}
";

      // Do the censor thang.
      censorText($context['message']['body']);
      censorText($context['message']['subject']);

      // Run BBC interpreter on the message.
      $context['message']['body'] = parse_bbc($context['message']['body'], $context['message']['smileys_enabled'], $context['message']['id_msg']);
   }

   $context['sub_template'] = 'main';
   $context['page_title'] = $txt['karma_add_to'];
   $context['topic'] = $topic;
   $context['m'] = $message;
   $context['uid'] = $uid;
   $context['can_pos_rep'] = allowedTo('positive_karma');
   $context['can_neg_rep'] = allowedTo('negative_karma');

   loadTemplate('Karma');
}
?>

Fustrate

When you make a post (or just edit that one), click "Additional Options..." below the post box, and it will have an upload area.
Steven Hoffman
Former Team Member, 2009-2012

glennk


khamseen

Hey, I eventually got it to show up. Kept telling me it was able to install on my theme but it had missed the part that actually displays the rp icon on posts to allow it to be used.

Now I've got it running though it's not saving the comments. Like if I give someone rep and leave a comment, when I visit their profile to see their reputation it has that I gave them rep but doesn't have my comment it's just blank.
"In hope we find despair and in despair we find truth." - Myself


Fustrate

psynx: This is a 2.0-only mod.

khamseen: did you uninstall before you installed again?

glennk: I'm downloading it right now, I'll attach a fixed one in a few minutes.
Steven Hoffman
Former Team Member, 2009-2012


glennk

Hi Yoda.

That fixed the errors but still the comment I leave does not appear. When I check the persons profile it shows that rep has been left and who buy but the comment is missing.

Thanks - Glenn

Advertisement: