Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length

JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Mighty People Touch Karma Integration
Pages: [1]   Go Down
  Print  
Author Topic: Mighty People Touch Karma Integration  (Read 5970 times)
0 Members and 1 Guest are viewing this topic.
mobilist41
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« on: June 03, 2010, 19:09:32 »

How can add Mighty People Touch  karma points integration to Jcomments?

There is a API using tutorial here: http://www.mightyextensions.com/knowledge-base/joomla-tutorials/item/developer-center/100-peopletouch-community/22822-increasedecrease-user-karma-points


I want to make integrate it with:
adding
deleting
voting (for user that votes and user that comment author)
comments.

Thanks.
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #1 on: July 05, 2010, 02:02:12 »

I've made simple plugin for karma integration. I haven't tested it yet because I don't use Mighty People Touch. But if API description you gave me is right - all must work fine.

Just install it as Joomla's plugin, publish and setup - in plugin parameters you could set points amount for adding, publishing or deleting comments.

* plg_jcomments_mightypeopletouchkarma_v1.0.zip (1.17 KB - downloaded 235 times.)
* plg_jcomments_mightypeopletouchkarma_v1.2.zip (1.66 KB - downloaded 283 times.)
« Last Edit: July 31, 2010, 19:05:56 by smart » Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
mobilist41
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #2 on: July 05, 2010, 14:10:18 »

Thanks a lot smart.  Wink  It works fine.  Cheesy
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #3 on: July 05, 2010, 15:41:21 »

Ok, in this case I'll release this plugin to public in nearest time. Also some new options would be added. Thank you for testing!
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
mobilist41
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #4 on: July 29, 2010, 22:42:21 »

Thanks a lot again.


I want to give karma when somebody vote an user's comment and added this code to the plugin:

Code:
function onCommentVote(&$comment, &$response, &$value)
{
if ($comment->userid) {
$mptAPI = JPATH_ROOT.DS.'components'.DS.'com_community'.DS.'api.php';
if(file_exists($mptAPI)) {
require_once($mptAPI);
if ($value > 0) { $amount = $this->params->def('good_vote', 1); }
else { $amount = $this->params->def('poor_vote', -1); }
JSCommunityApi::increaseKarma($comment->userid, $amount);
}
}
}


Code:
<param name="good_vote" type="text" default="1" label="Good Vote" description="" />
<param name="poor_vote" type="text" default="-1" label="Poor Vote" description="" />


Also tried onAfterCommentVoted instead of onCommentVote and added new params to xml file but it increase user's karma +1 everytime even if poor vote. How can i get vote value (good or poor)? Maybe i can fix it until you release it.
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #5 on: July 30, 2010, 12:05:59 »

Also tried onAfterCommentVoted instead of onCommentVote and added new params to xml file but it increase user's karma +1 everytime even if poor vote. How can i get vote value (good or poor)? Maybe i can fix it until you release it.
The JComments 2.2 has no such event - it will be available with next version. But you could add it manually. Open /components/com_jcomments/jcomments.ajax.php find code:
Code: (php)
$query = "INSERT INTO `#__jcomments_votes`(`commentid`,`userid`,`ip`,`date`,`value`)"
. "VALUES('".$comment->id."', '".$acl->getUserId()."','".$db->getEscaped($ip)."', now(), ".$value.")";
$db->setQuery($query);
$db->query();
and add after:
Code: (php)
if ($config->getInt('enable_mambots') == 1) {
JCommentsPluginHelper::trigger('onAfterCommentVoted', array(&$comment, &$response, $value));
}
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
mobilist41
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #6 on: July 30, 2010, 17:58:11 »

It worked. Thanks.  Cheesy

But i saw this event on AlphaUserPoints plugin. How can it use onAfterCommentVoted event?
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #7 on: July 30, 2010, 18:03:41 »

But i saw this event on AlphaUserPoints plugin. How can it use onAfterCommentVoted event?
It can use this event with current development version only. I've made new plugin and test it with upcoming version. I'm going to release them together. Here I've published it as pre-prelease because some users ask me about this.

You patch for Mighty People Touch Karma Integration will be also included in final version of this plugin.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #8 on: July 31, 2010, 19:08:02 »

I've updated the plugin and attach new version in previous message.

What's new in JComments - Mighty PeopleTouch Karma 1.2?

1. Assign points to the author when the comment has got positive vote
2. Assign points to the author when the comment has got negative vote
3. Assign points when a user votes a comment
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
mobilist41
Jr. Member
**

Karma: 0
Offline Offline

Posts: 14


« Reply #9 on: August 16, 2010, 05:39:25 »

I've updated the plugin and attach new version in previous message.

What's new in JComments - Mighty PeopleTouch Karma 1.2?

1. Assign points to the author when the comment has got positive vote
2. Assign points to the author when the comment has got negative vote
3. Assign points when a user votes a comment

Very good... Could you add activity registration (wall) also? It's API here: http://www.mightyextensions.com/knowledge-base/joomla-tutorials/item/developer-center/100-peopletouch-community/22819-activity-registration-wall

I tried to add it to onAfterCommentAdded function but it didn't work.  Smiley
Logged
griz
Newbie
*

Karma: 0
Offline Offline

Posts: 6


Email
« Reply #10 on: March 24, 2011, 05:24:37 »

Dang...the install of both the plugin and the xml file went fine, but I still get no points for comments. (And the plugin and rules are activated.) Smart...you mentioned a patch. Might that be the problem? I haven't installed any patch. Could you direct me to it?

Thanks.

Griz
Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    Topic: Mighty People Touch Karma Integration
 
Jump to: