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    AlphaUserPoints    Topic: JComments 2.3.0 & Joomla 2.5 AUP?
Pages: [1]   Go Down
  Print  
Author Topic: JComments 2.3.0 & Joomla 2.5 AUP?  (Read 28117 times)
0 Members and 1 Guest are viewing this topic.
evilshinobi
Newbie
*

Karma: 1
Offline Offline

Posts: 6


Email
« on: March 09, 2012, 16:43:33 »

Hello everybody

I tried to put in the code for AlphaUserPlugin:

 
Code:
    $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
                    if ( file_exists($api_AUP))
                    {
                    require_once ($api_AUP);
                        AlphaUserPointsHelper::newpoints( 'plgaup_jcomments_newcomment' ); 
                    }

But in which place do I have to copy it? I tried in many functions in "jcomments.ajax.php" (especially somewhere after the function "public static function addComment($values = array())"

But it never worked... So do somebody know how to do this? Or is this a work in progress for an update anyway?
I use AlphaUserPoints 1.7.2 btw.
Logged
Josh
Jr. Member
**

Karma: 8
Offline Offline

Gender: Male
Posts: 29



WWW Email
« Reply #1 on: March 11, 2012, 13:14:13 »

I too would like a plugin for the new jcomments and AUP 1.7.2.  Cheesy
Logged
evilshinobi
Newbie
*

Karma: 1
Offline Offline

Posts: 6


Email
« Reply #2 on: April 13, 2012, 15:26:25 »

I too would like a plugin for the new jcomments and AUP 1.7.2.  Cheesy

Hey! Good news, I made it!  Grin

You have to add some lines in ".../com_jcomments/jcomments.ajax.php" after the line 306: unset($currentUser);

It looks then like this:
Code:
$db = JCommentsFactory::getDBO();

// small fix (by default $my has empty 'name' and 'email' field)
if ($user->id) {
$currentUser = JCommentsFactory::getUser($user->id);
$user->name = $currentUser->name;
$user->username = $currentUser->username;
$user->email = $currentUser->email;
unset($currentUser);

            /////ALphaUserPoints Integration/////
                    $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
                    if ( file_exists($api_AUP))
                    {
                    require_once ($api_AUP);
                        AlphaUserPointsHelper::newpoints( 'plgaup_jcomments_add_comment', '', '', 'in here = detail' );   
                    }
                    /////END ALphaUserPoints Integration/////

}

if (empty($values['name'])) {
$values['name'] = 'Guest'; // JText::_('Guest');
}

But I'd like also to see, where or what somebody had commented.. For that, something must be inserted into 'in here = detail' . But I couldn't find out what and how...
 
Logged
MissyW
Newbie
*

Karma: 0
Offline Offline

Posts: 4


« Reply #3 on: April 16, 2012, 12:18:25 »

I too would like a plugin for the new jcomments and AUP 1.7.2.  Cheesy

Hey! Good news, I made it!  Grin

You have to add some lines in ...
 
Thanks for sharing your code in the above post.  But I'm confused ... is this all I need to do to create AUP integration (Joomla 1.7)?  Is this INSTEAD of the plugin that Smart offered here http://www.joomlatune.com/forum/index.php/topic,1885.0.html for Joomla1.5???
Logged
evilshinobi
Newbie
*

Karma: 1
Offline Offline

Posts: 6


Email
« Reply #4 on: April 19, 2012, 19:31:57 »

No that's not everything what you could do... This is just the code, for adding points if somewhone has posted something. Certainly you have to upload also the xml-plugin
Code:
<?xml version="1.0" encoding="utf-8"?>
<alphauserpoints type="plugin">
    <rule>Comment</rule>
    <description>Give Points to user, when commented</description>
    <component>JComments</component>
    <plugin_function>plgaup_jcomments_add_comment</plugin_function>
    <fixed_points>true</fixed_points>
</alphauserpoints>

Of course you could add more things, like points for deleting, editing, voting etc. But I havn't done this yet, because it was not important for me yet. I'm sorry, I can't tell you where you have to put the lines, because I havn't tried it and my file is edited...

But I think, the integration for delete must be inserted after the last line.. or maybe much later.. There are so many elses^^
Code:
public static function deleteComment($id)
{
if (JCommentsSecurity::badRequest() == 1) {
JCommentsSecurity::notAuth();
}

$acl = JCommentsFactory::getACL();
$db = JCommentsFactory::getDBO();
$config = JCommentsFactory::getConfig();
$response = JCommentsFactory::getAjaxResponse();

$comment = new JCommentsTableComment($db);

and for vote maybe after the last line here:
Code:
public static function voteComment($id, $value)
{
$acl = JCommentsFactory::getACL();
$db = JCommentsFactory::getDBO();
$response = JCommentsFactory::getAjaxResponse();

$id = (int) $id;
$value = (int) $value;
$value = ($value > 0) ? 1 : -1;

$ip = $acl->getUserIP();

$query = 'SELECT COUNT(*) FROM `#__jcomments_votes` WHERE commentid = ' . $id;

if ($acl->getUserId()) {
$query .= ' AND userid = ' . $acl->getUserId();

Maybe I will try it sometime, if I have time for this. Because I'm hoping, that an official intergration will be released sometime or someone who is better in this will publish something, because I'm not so good at coding^^...
« Last Edit: April 19, 2012, 19:39:09 by evilshinobi » Logged
yaksushi
Jr. Member
**

Karma: 0
Offline Offline

Posts: 18


Email
« Reply #5 on: May 05, 2012, 00:01:07 »

I too would like a plugin for the new jcomments and AUP 1.7.2.  Cheesy

Hey! Good news, I made it!  Grin

You have to add some lines in ".../com_jcomments/jcomments.ajax.php" after the line 306: unset($currentUser);

It looks then like this:
Code:
$db = JCommentsFactory::getDBO();

// small fix (by default $my has empty 'name' and 'email' field)
if ($user->id) {
$currentUser = JCommentsFactory::getUser($user->id);
$user->name = $currentUser->name;
$user->username = $currentUser->username;
$user->email = $currentUser->email;
unset($currentUser);

            /////ALphaUserPoints Integration/////
                    $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
                    if ( file_exists($api_AUP))
                    {
                    require_once ($api_AUP);
                        AlphaUserPointsHelper::newpoints( 'plgaup_jcomments_add_comment', '', '', 'in here = detail' );   
                    }
                    /////END ALphaUserPoints Integration/////

}

if (empty($values['name'])) {
$values['name'] = 'Guest'; // JText::_('Guest');
}

But I'd like also to see, where or what somebody had commented.. For that, something must be inserted into 'in here = detail' . But I couldn't find out what and how...
 


This code does not work, has anyone got this working?
Logged
evilshinobi
Newbie
*

Karma: 1
Offline Offline

Posts: 6


Email
« Reply #6 on: May 07, 2012, 15:13:07 »


This code does not work, has anyone got this working?

Hi

What isn't working with you? This implementation just gives you points, if you've commented. You need then to upload a XML-File for AlphaUserPoints under Plugins.

Code:
<?xml version="1.0" encoding="utf-8"?>
<alphauserpoints type="plugin">
    <rule>Comment</rule>
    <description>Give Points to user, when commented</description>
    <component>JComments</component>
    <plugin_function>plgaup_jcomments_add_comment</plugin_function>
    <fixed_points>true</fixed_points>
</alphauserpoints>
Logged
yaksushi
Jr. Member
**

Karma: 0
Offline Offline

Posts: 18


Email
« Reply #7 on: May 08, 2012, 19:35:45 »

In AUP 1.7 you can manually add the rules, you no longer have upload an xml.

http://awesomescreenshot.com/02e55n2f9

I manually created the rule added your code but it doesn't work, it acutally causes the comments to not be submitted at all.  I'm able to implement this in other components like Chronoforms but not Jcomments....  Huh

Here is my code in the jcomments.ajax.php

Code:
// small fix (by default $my has empty 'name' and 'email' field)
if ($user->id) {
$currentUser = JCommentsFactory::getUser($user->id);
$user->name = $currentUser->name;
$user->username = $currentUser->username;
$user->email = $currentUser->email;
unset($currentUser);

/////ALphaUserPoints Integration/////
                    $api_AUP = JPATH_SITE.DS.'components'.DS.'com_alphauserpoints'.DS.'helper.php';
                    if ( file_exists($api_AUP))
                    {
                    require_once ($api_AUP);
                        AlphaUserPointsHelper::newpoints( 'plgaup_jcomments_add_comment', '', '', 'in here = detail' );   
                    }
                    /////END ALphaUserPoints Integration/////
}

if (empty($values['name'])) {
$values['name'] = 'Guest'; // JText::_('Guest');
}

$comment = new JCommentsTableComment($db);
$comment->id = 0;
$comment->name = $user->id ? $user->name : preg_replace("/[\'\"\>\<\(\)\[\]]?+/i", '', $values['name']);
$comment->username = $user->id ? $user->username : $comment->name;
$comment->email = $user->id ? $user->email : (isset($values['email']) ? $values['email'] : '');
« Last Edit: May 08, 2012, 19:47:00 by yaksushi » Logged
evilshinobi
Newbie
*

Karma: 1
Offline Offline

Posts: 6


Email
« Reply #8 on: May 08, 2012, 20:18:04 »

Ok, thats strange. It should work... Maybe there is a comma or something else somewhere too much...

You can try my file which is working for me: http://www.smallfiles.org/download/460/jcomments.ajax.php.html

For some reasons, the AlphaUserPoints-Component has its problems for non-english Joomla-sites.
I solved this problem, by going into "plugin.php" on line 103 (...\joomla\libraries\joomla\plugin\plugin.php) and wrote // before
Code:
|| $lang->load(strtolower($extension), JPATH_PLUGINS . '/' . $this->_type . '/' . $this->_name, null, false, false)
This is a language plugin for joomla, I don't know, what it does, but I've got no problems at all with this changes...
Logged
yaksushi
Jr. Member
**

Karma: 0
Offline Offline

Posts: 18


Email
« Reply #9 on: May 08, 2012, 20:48:27 »

I have no idea why your file worked and mine didn't....  I used beyond compare and couldn't find any difference.....  WTF?  Anyway thanks for the help!  Cheesy
Logged
piersol
Newbie
*

Karma: 0
Offline Offline

Posts: 4


Email
« Reply #10 on: June 08, 2013, 11:13:26 »

Does anyone know how to make the Title of the item being commented on to appear in the history tab? I need it for hwdmediashare and for com_content? Currently with this information above it works but the title doesnt show so no way for them to know which they got credit for.

Logged
Josh
Jr. Member
**

Karma: 8
Offline Offline

Gender: Male
Posts: 29



WWW Email
« Reply #11 on: June 08, 2013, 13:22:53 »

In cast this helps the plugin was released for Joomla 2.5 as seen here:
http://www.joomlatune.com/jcomments-plugins.html#plg_jcomments_alphauserpoints
Logged
piersol
Newbie
*

Karma: 0
Offline Offline

Posts: 4


Email
« Reply #12 on: June 08, 2013, 13:46:00 »

Thank you, yes thats what im using. Unfortunately it leaves the type of action blank, unlike plugins for example that give points for read articles, it gives the name of the article that earned the points. This leaves just a blank.
Logged
smart
Administrator
Hero Member
*****

Karma: 186
Offline Offline

Gender: Male
Posts: 1883



WWW
« Reply #13 on: July 30, 2013, 16:28:21 »

Does anyone know how to make the Title of the item being commented on to appear in the history tab?
Where I can see this history tab? I am not using AUP so I do not know all it's features.
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    Integration with third-party extensions    AlphaUserPoints    Topic: JComments 2.3.0 & Joomla 2.5 AUP?
 
Jump to: