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    K2 JComments    Topic: K2 and JComments integration problem
Pages: [1]   Go Down
  Print  
Author Topic: K2 and JComments integration problem  (Read 6798 times)
0 Members and 1 Guest are viewing this topic.
Joe Stokes
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« on: June 28, 2010, 17:46:03 »

I am using the K2 user login module and JComments to post comments on articles.

The article comments display correct and all functions are working well.
All comments are appended into the jos_jcomments table as would be expected.

However, in the K2 login module, the link to "Moderate comments to my published items" calls for comments in the jos_K2_comments table which naturally do not exist (they are in the jos_jcomments table). Furthermore, the comments counter reports: "You have 0 published comments." (no records in jos_k2_comments table)

Is there a way to "tweak" the K2 Login module to rather interrogate the jos_comments table to report the number of comments? I could alter the SQL SELECT query to include a UNION function to include comment count from both tables.

Regarding the ability to moderate comments (a K2 function), it is not that simple as the comments are in the jos_jcomments table.

Is there any other way to try and fix this?

Running Joomla 1.5.18, K2.2, JComments v2.2.0

ps. running on local server to test, so can not link you to site.

Regards

Joe
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #1 on: June 28, 2010, 19:29:48 »

Regarding comments counter in K2 login module I think you need ask the K2 developers to support displaying comments count through K2 plugins also. This feature works in component and in my mind it is easy to use same function in module.

About comments moderation. Why not moderate all site comments from JComments backend or Quick moderation feature (from administrator's notifications)?
Logged

If you use JComments, please post a rating and a review at the Joomla! Extensions Directory
Joe Stokes
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« Reply #2 on: June 28, 2010, 19:51:54 »

Hi,

Thanks for the advice, moderating comments form back-end could make more sense - will consider it.

Regarding the message counter of K2, the solution is very simple: (this is info for those that my want to apply it)

Edit the <joursite_url>\modules\mod_k2_login\helper.php

change line 70 from: $query = "SELECT COUNT(*) FROM #__K2_comments WHERE userID={$userID} AND published=1" ;

to                         : $query = "SELECT COUNT(userid) FROM #__jcomments WHERE userid={$userID} AND published=1" ;

This allows the module to interrogate the jos_jcomments table instead of the jos_k2_comments table.

You will note that there is a change after the WHERE clause - this is to refer to the field that holds the user ID. The two tables do not use the same naming standard.

The SELECT COUNT(*) verses SELECT COUNT(userid) modification is optional - This is a personal preference really, although the COUNT(userid) is just slightly more efficient in serving up the result.

Thanks once again and have fun

Joe

Logged
KarmicVisions
Newbie
*

Karma: 0
Offline Offline

Posts: 1


Email
« Reply #3 on: October 21, 2010, 05:14:39 »

Joe -

Did you ever find a way to customize the k2 login module for the comment moderation?

Thank you,
Darlene
Logged
lbarriocanal
Newbie
*

Karma: 0
Offline Offline

Posts: 1


« Reply #4 on: January 31, 2011, 00:55:41 »


change line 70 from: $query = "SELECT COUNT(*) FROM #__K2_comments WHERE userID={$userID} AND published=1" ;

to                         : $query = "SELECT COUNT(userid) FROM #__jcomments WHERE userid={$userID} AND published=1" ;


Hi, Joe.

Any of two lines of code shows ever my comments in K2 comments, not in jcomments. I have deleted cache and log out and log in many times with no luck.
Have I to chage anything more? Thanks in advance.
Logged
marcodeluca
Newbie
*

Karma: 0
Offline Offline

Posts: 3


« Reply #5 on: February 01, 2011, 04:06:55 »

Would anyone be able to supply the code to make the same changes to K2_content? I realize it's probably the same sort of thing, but the code that makes calls to the DB for comments is a little different in that module:)
Logged
smart
Administrator
Hero Member
*****

Karma: 163
Offline Offline

Gender: Male
Posts: 2161



WWW
« Reply #6 on: February 01, 2011, 18:06:01 »

In the latest K2 Content module you have to replace code:

Code: (php)
$query .= " LEFT JOIN #__k2_comments comments ON comments.itemID = i.id";
with
Code: (php)
$query .= " LEFT JOIN #__jcomments comments ON comments.object_group='com_k2' and comments.object_id = i.id";

But in my mind this modification isn't need because we have in K2 Content's module parameter called "Comments counter and anchor link".
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    K2 JComments    Topic: K2 and JComments integration problem
 
Jump to: