Support ⇒ Modules & Blocks ⇒ Kudos - AddOn ⇒ Community Forums ⇒ CPG Dragonfly™ CMS
Forum IndexModules & Blocks

Kudos - AddOn Reply to topic

Go to page 1, 2, 3 Next

I downloaded Kudo's addon from brokencrust.com/ and installed it. However, there's changes that need to be made to ForumsPro that I'm not able to find.

CMS Version 9.2.1
PHP Version 5.2.14
MySQL Version 5.0.91-log (client: 5.0.45)
GD Version bundled (2.0.34 compatible)

ForumsPro Version 2.0.0.1


The documentation states to hit a wiki page, that's no longer active. Anyone know how to fix this? Thank you.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


As far as I can see, Kudos provides for ForumsPro by selecting it in the admin panel.

nm - see what you mean - his wiki no longer exists for the forum files that need changes.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


I'm not having much luck figuring out how to get it integrated, or finding documentation either. I did email him this morning.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


Problem is, even if you check the internet archive, it only links to his non-existent downloads section.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Have you tried asking BrokenCrust? He's still about. Or contact through his website.

Pro_News CM™ - Content Management for Dragonfly CMS™

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / 1.3.39 - 2.4.9 / 5.5.42 - 5.6.16 / 5.4.37 - 5.5.11 / 9.4


Although I have created a new site and added the downloads, I haven't really got further than that. Each of the modules requires a complete overhaul which would include updating the files with new contact and usage information.

I haven't really decided if I want to spend the time doing all that since few people remain with DF and so I wonder if it is worth releasing this stuff again? Probably not.

I don't use either Kudos or ForumsPro myself so support for this combination is limited and I strongly advise you move away from it, since I certainly will remove support from Kudos for ForumsPro in the future if I do develop it further - as far as I am concerned ForumsPro is dead. Nothing last forever (just like my wiki which was deleted over 2 years ago and this is first time it has been missed).

However I do have some template replacements for FP 2 (and standard forums) which I had meant to include in a new download and I will try to do that today. The code changes in these are clearly marked and you can copy these sections to to your own templates if they are different, however most people have just replaced the files with no issues.

Please enter your server specs in your user profile! 😢


layingback wrote
Have you tried asking BrokenCrust? He's still about. Or contact through his website.


Yes sir. Smile

SlickVision wrote
I'm not having much luck figuring out how to get it integrated, or finding documentation either. I did email him this morning.




BrokenCrust wrote
Although I have created a new site and added the downloads, I haven't really got further than that. Each of the modules requires a complete overhaul which would include updating the files with new contact and usage information.

I haven't really decided if I want to spend the time doing all that since few people remain with DF and so I wonder if it is worth releasing this stuff again? Probably not.

I don't use either Kudos or ForumsPro myself so support for this combination is limited and I strongly advise you move away from it, since I certainly will remove support from Kudos for ForumsPro in the future if I do develop it further - as far as I am concerned ForumsPro is dead. Nothing last forever (just like my wiki which was deleted over 2 years ago and this is first time it has been missed).

However I do have some template replacements for FP 2 (and standard forums) which I had meant to include in a new download and I will try to do that today. The code changes in these are clearly marked and you can copy these sections to to your own templates if they are different, however most people have just replaced the files with no issues.


Hmm, I was aware ForumsPro being unsupported, but I like a lot of the features it provides.

Why did people leave DF and what's equally good, in terms of CMS?

Thank you for your response, I'll keep checking your site for said files.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


Edit modules/ForumsPro/posting.php

find:


if ($submit || $confirm) {
# Submit post/vote (newtopic, edit, reply, etc.)
$return_message = $return_link = '';
switch ($mode) {
case 'editpost':
case 'newtopic':
case 'reply':
$is_error |= forumspro_post_message($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $attach_sig, $desc4mod, $return_message, $return_link, $forum_id, $topic_id, $post_id, $poll_id, $topic_type);
break;

case 'delete':


Then add:


// Kudos Module
if (is_active('Kudos')) {
$k_forum = $db->sql_fetchrow($db->sql_query("SELECT kudos_del_post FROM ".$prefix."_kudos_forums WHERE forum_id=".$forum_id));
if ($k_forum['kudos_del_post'] > 0) {
$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_pos=kudos_pos-".$k_forum['kudos_del_post']." WHERE user_id=".$userinfo['user_id']);
}
require_once('modules/Kudos/groups.inc');
check_groups($userinfo['user_id']);
}
// End Kudos Module


now find:


if ('poll_delete'!=$mode) {
forumspro_user_notification($mode, $post_data, $post_info['topic_title'], $cat_id, $forum_id, $topic_id, $post_id, $notify_user);
}
if ('newtopic'==$mode || 'reply'==$mode) {


below add:

// Kudos Module
if (is_active('Kudos')) {
$k_forum = $db->sql_fetchrow($db->sql_query("SELECT kudos_post FROM ".$prefix."_kudos_forums WHERE forum_id=".$forum_id));
if ($k_forum['kudos_post'] > 0) {
$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_pos=kudos_pos+".$k_forum['kudos_post']." WHERE user_id=".$userinfo['user_id']);
}
require_once('modules/Kudos/groups.inc');
check_groups($userinfo['user_id']);
}
// End Kudos Module


Those changes let you add (for posting) / delete (for a post being deleted) Kudos.
Long ago worked fine.

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


Sorry, but it looks like I binned the files last year (since I was never going to support FP any more). I guess someone might have them hanging around. Note though that I'm pretty sure that what greenday2k posted is from version 1.x of Kudos, since in 2.0 it changed to being a class. I'm a bit surprised that I don't have them and I'll look around in some archives later to double check. I do still have them for Forums921 and News921 and I'll add them into the download at some point.

Please enter your server specs in your user profile! 😢


It appears to be working fine if you click a members profile, and scroll to the bottom and manage it that way. Adding and subtracting work well.


I'm hoping to have something similar to the Karma module incorporated like the graphic below.



And if it could increment one's Kudos total after post in specific forums containing 50 or more characters, that'd be a bonus.



I was thinking I could emulate the same process in the members profile on the tpl of the topicview (?), right?

Edit, greenday2k, I tried what you instructed and got an error. I'm at work so quickly reverted back. If interested, I can duplicate it and respond with it.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


Not much of a surprise, but its not as easy as I had hoped. I think I have to edit the posts_lists.html file, but each of my attempts failed.

Hoping someone has the changes.

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


If someone can post the changes need for the standard forums, i can make changes needed for Fpro.

Seems that we are missing BrokenCrust Wiki. If BC uses a class it would be easier to make work with fpro.

www.greenday2k.net

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):


I was able to find this.

ForumsPro
html > includes > ForumsPro > display_posts.php
html > modules > ForumsPro > posting.php
html > modules > ForumsPro > viewtopic.php
html > themes > default >template > forumspro > posts_list.html


That's just saying what files need to be changed. Still working on finding what the changes are.

I found an archive of the wiki, but I feel it is probably wrong.


----
If you use a theme that changes the look of the forum then it is likely that the template included in these files will change that look and you will therefore need to copy the Kudos code by hand. Copy the lines below (and all lines between them into a similar place in your template).
<!-- IF C_K_ACTIVE -->
.
.
.
<!-- ENDIF --> 


These files require that you install ForumsPro 2.0.0.0 first. They will not work with any other version of Forums or ForumsPro.
----

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


I believe this is the class you were mentioning?

<?php
/**********************************************
  Kudos Module for CPG-NUKE 9.2.x
 **********************************************
  Copyright (c) 2007-08

  $Revision: 2.0 $
  $Author: BrokenCrust $
  $Date: 2008/09/14 $

***********************************************/

class kudos {

	protected $to_id;
	protected $from_id;
	protected $amount;
	protected $reason_id;

	public function __construct($to_id, $amount) {

		$this->to_id     = intval($to_id);
		$this->amount    = intval($amount);
		$this->from_id   = 0;
		$this->reason_id = 0;
	}

	public function credit($reason_id = 1) {
		global $userinfo, $MAIN_CFG;

		$this->from_id   = $userinfo['user_id'];
		$this->reason_id = intval($reason_id);

		if (($this->amount != 0) && ($this->to_id != 0)) {
			$this->user_check();
			if (!can_admin('Kudos')) {
				$this->self_check();
				$this->flood_check();
				$this->bully_check();
				$this->amount_check();
			}
			$this->alter_kudos();
			if (!can_admin('Kudos')) {
				$this->set_time();
			}
			$this->history();
			$this->check_groups();
		}
	}

	public function donation($from_id, $reason_id = 13) {

		$this->from_id   = intval($from_id);
		$this->reason_id = intval($reason_id);

		if (($this->amount != 0) && ($this->to_id != 0) && ($this->from_id != 0)) {

			$this->user_check();

			if ($this->amount < 1) { cpg_error(_K_NOT_POS); }

			if (!can_admin('Kudos')) {
				$this->self_check();
				$this->credit_check();
			}
			$this->donate();

			$this->from_id   = $this->to_id;
			$this->to_id     = intval($from_id);
			$this->amount    = (0 - $this->amount);

			$this->donate();
		}
	}

	public function change($reason_id = 0) {
		global $userinfo;

		$this->from_id   = $userinfo['user_id'];

		if (($this->amount != 0) && ($this->to_id != 0)) {
			$this->user_check();
			$this->alter_kudos();
			if (intval($reason_id) > 0) {
				$this->reason_id = intval($reason_id);
				$this->history();
			}
			$this->check_groups();
		}
	}

	public function posting($message, $min = 0, $scale = 0, $reason_id = 0) {
		global $db, $user_prefix;

		$min = intval($min);
		$scale = intval($scale);
		$length = mb_strlen($message, 'UTF-8');

		if ($length < $min) {
			$this->amount = 0;
		} else {
			if ($scale > 0) {
				$this->scale_credit($length, $scale);
			}
		}
		if (($this->amount != 0) && ($this->to_id != 0)) {
			$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_pos=kudos_pos+".$this->amount." WHERE user_id=".$this->to_id);
			if (intval($reason_id) > 0) {
				$this->reason_id = intval($reason_id);
				$this->history();
			}
			$this->check_groups();
		}
	}

	public function undo() {
		global $db, $user_prefix;

		if (can_admin('Kudos')) {

			if (($this->amount != 0) && ($this->to_id != 0)) {

				if ($this->amount > 0) {
					$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_pos=kudos_pos-".$this->amount." WHERE user_id=".$this->to_id);
				} else {
					$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_neg=kudos_neg+".$this->amount." WHERE user_id=".$this->to_id);
				}

				$this->check_groups();
			}
		}
	}

	public function reset_user() {
		global $db, $prefix, $user_prefix;

		if (can_admin('Kudos')) {

			if ($this->to_id != 0) {
				if ($amount < 0) {
					$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_neg=0-".$this->amount.", kudos_pos=0 WHERE user_id=".$this->to_id);
				} else {
					$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_neg=0, kudos_pos=".$this->amount." WHERE user_id=".$this->to_id);
				}
				$this->check_groups();

				$result = $db->sql_query("DELETE FROM ".$prefix."_kudos_history WHERE kudos_to=".$this->to_id);
			}
		}
	}

	public static function is_solvent($user_id = 0, $amount = 1) {
		global $db, $user_prefix, $userinfo;

		$solvent = false;

		$user_id = intval($user_id);
		$amount = intval($amount);

		if ($user_id == 0) { $user_id = $userinfo['user_id']; }

		$check = $db->sql_fetchrow($db->sql_query("SELECT kudos_pos-kudos_neg AS kudos FROM ".$user_prefix."_users WHERE user_id=".$user_id));

		if ($check['kudos'] >= $amount) { $solvent = true; }

	return $solvent;
	}

	private function donate() {

		$this->alter_kudos();
		$this->history();
		$this->check_groups();
	}

	private function user_check() {

		if (!is_user()) {
			cpg_error('<p>'._MODULEUSERS.($MAIN_CFG['member']['allowuserreg'] ? _MODULEUSERS2 : '').'</p>', 401);
		}
	}

	private function self_check() {

		if ($this->to_id == $this->from_id) {
			cpg_error(_K_SELF);
		}
	}

	private function flood_check() {
		global $db, $user_prefix, $MAIN_CFG, $userinfo;

		if ($MAIN_CFG['kudos']['kudos_delay'] > 0) {

			$check = $db->sql_fetchrow($db->sql_query("SELECT kudos_next_time FROM ".$user_prefix."_users WHERE user_id=".$this->from_id));

			if ($check['kudos_next_time'] > gmtime()) {

				$delay_name = array(30 => _K_30S, 60 => _K_1M, 120 => _K_2M, 600 => _K_10M, 1800 => _K_30M, 3600 => _K_1H, 7200 => _K_2H, 14400 => _K_4H, 28800 => _K_8H, 43200 => _K_12H, 86400 => _K_1D);

				cpg_error (_K_FLOODING.' '._K_WAIT.' '.$delay_name[$MAIN_CFG['kudos']['kudos_delay']]);
			}
		}
	}

	private function bully_check() {
		global $db, $prefix, $MAIN_CFG, $userinfo;

		if ($MAIN_CFG['kudos']['kudos_user_delay'] > 0) {

			$check = $db->sql_fetchrow($db->sql_query("SELECT MAX(kudos_time) AS kudos_next_time FROM ".$prefix."_kudos_history WHERE kudos_to=".$this->to_id." AND kudos_from=".$this->from_id." AND kudos_reason=1"));

			if (!empty($check['kudos_next_time'])) {

				if (($check['kudos_next_time'] + $MAIN_CFG['kudos']['kudos_user_delay']) > gmtime()) {

					$delay_name = array(30 => _K_30S, 60 => _K_1M, 120 => _K_2M, 600 => _K_10M, 1800 => _K_30M, 3600 => _K_1H, 7200 => _K_2H, 14400 => _K_4H, 28800 => _K_8H, 43200 => _K_12H, 86400 => _K_1D);

					cpg_error (_K_FLOODING_USER.' '._K_WAIT.' '.$delay_name[$MAIN_CFG['kudos']['kudos_user_delay']]);
				}
			}
		}
	}

	private function amount_check() {
		global $MAIN_CFG;

		if (($this->amount > $MAIN_CFG['kudos']['kudos_max']) && ($this->amount < (0 - $MAIN_CFG['kudos']['kudos_max']))) {
			$MAIN_CFG['kudos']['kudos_max'] == 0 ? cpg_error(_K_ONLY_ADMIN_CHANGES) : cpg_error(_K_OUTSIDE_RANGE);
		}
	}

	private function alter_kudos() {
		global $db, $user_prefix;

		if ($this->amount > 0) {
			$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_pos=kudos_pos+".$this->amount." WHERE user_id=".$this->to_id);
		} else {
			$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_neg=kudos_neg-".$this->amount." WHERE user_id=".$this->to_id);
		}
	}

	private function set_time() {
		global $db, $user_prefix, $MAIN_CFG, $userinfo;

		$next_time = gmtime() + $MAIN_CFG['kudos']['kudos_delay'];

		$result = $db->sql_query("UPDATE ".$user_prefix."_users SET kudos_next_time=".$next_time." WHERE user_id=".$userinfo['user_id']);
	}

	private function history() {
		global $db, $prefix, $MAIN_CFG;

		if ($MAIN_CFG['kudos']['kudos_history'] > 0) {

			$history = $db->sql_fetchrow($db->sql_query("SELECT COUNT(kudos_id) AS row_count, MIN(kudos_time) AS oldest_row FROM ".$prefix."_kudos_history WHERE kudos_to=".$this->to_id));

			if ($history['row_count'] > $MAIN_CFG['kudos']['kudos_history']) {

				$result = $db->sql_query("DELETE FROM ".$prefix."_kudos_history WHERE kudos_time=".$history['oldest_row']." AND kudos_to=".$this->to_id);
			}
			$result = $db->sql_query("INSERT INTO ".$prefix."_kudos_history VALUES (NULL, ".$this->to_id.", ".$this->from_id.", ".gmtime().", ".$this->reason_id.", ".$this->amount.")");
		}
	}

	private function credit_check() {
		global $db, $user_prefix;

		$check = $db->sql_fetchrow($db->sql_query("SELECT kudos_pos-kudos_neg AS kudos FROM ".$user_prefix."_users WHERE user_id=".$this->from_id));

		if ($kudos < $check['kudos']) {
			cpg_error(_K_NO_CREDIT);
		}
	}

	private function check_groups() {
		global $db, $prefix, $user_prefix;

		$groups = $db->sql_query("SELECT group_id FROM ".$prefix."_bbgroups WHERE group_id NOT IN (SELECT ug.group_id FROM ".$prefix."_bbuser_group AS ug WHERE ug.user_id=".$this->to_id.") AND group_kudos_give <= (SELECT kudos_pos-kudos_neg FROM ".$user_prefix."_users WHERE user_id=".$this->to_id.") AND group_kudos_give <> 0");

		if ($db->sql_numrows($groups) > 0) {
			while ($group = $db->sql_fetchrow($groups)) {
				$result = $db->sql_query("INSERT INTO ".$prefix."_bbuser_group VALUES (".$group['group_id'].", ".$this->to_id.", 0)");
			}
		}

		$groups = $db->sql_query("SELECT group_id FROM ".$prefix."_bbgroups WHERE group_id IN (SELECT ug.group_id FROM ".$prefix."_bbuser_group AS ug WHERE ug.user_id=".$this->to_id.") AND group_kudos_give > (SELECT kudos_pos-kudos_neg FROM ".$user_prefix."_users WHERE user_id=".$this->to_id.") AND group_kudos_give <> 0 AND group_kudos_take = 1");

		if ($db->sql_numrows($groups) > 0) {
			while ($group = $db->sql_fetchrow($groups)) {
				$result = $db->sql_query("DELETE FROM ".$prefix."_bbuser_group WHERE group_id=".$group['group_id']." AND user_id=".$this->to_id);
			}
		}
	}

	private function scale_credit($length, $scale) {

		$multiplier = floor($length / $scale);
		if ($multiplier > 1) {
			$this->amount = $this->amount * $multiplier;
		}
	}
}
?>

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1


greenday2k wrote
If someone can post the changes need for the standard forums, i can make changes needed for Fpro.

Seems that we are missing BrokenCrust Wiki. If BC uses a class it would be easier to make work with fpro.


The code above is the class. Does that help?

Server specs (Server OS / Apache / MySQL / PHP / DragonflyCMS):
Linux / MySQL 5.0.81/ PHP 4.4.9 / CMS Ver 9.2.1

All times are UTC
Go to page 1, 2, 3 Next


Jump to: