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

Login with username, password and session length

JoomlaTune Support Forum    JComments component    General discussion    Topic: Same Comment
Pages: [1]   Go Down
  Print  
Author Topic: Same Comment  (Read 786 times)
0 Members and 1 Guest are viewing this topic.
bgcs3
Newbie
*

Karma: 0
Offline Offline

Posts: 2


Email
« on: October 04, 2010, 17:42:49 »

Hello!

Thank you for your GREAT component. I use it with k2.
My question is how can I turn off the protection of that users can't send the same comment? The language string for this is : ERROR_DUPLICATE_COMMENT

Thank you for your answer.

Bye.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: October 04, 2010, 17:53:33 »

Open /components/com_jcomments/jcomments.ajax.php and replace code:
Code: (php)
$query = "SELECT COUNT(*) "
. "\nFROM #__jcomments "
. "\nWHERE comment = '" . $db->getEscaped($comment->comment) . "'"
. "\n  AND ip = '" . $db->getEscaped($comment->ip) . "'"
. "\n  AND name = '" . $db->getEscaped($comment->name) . "'"
. "\n  AND userid = '" . $comment->userid . "'"
. "\n  AND object_id = " . $comment->object_id
. "\n  AND parent = " . $comment->parent
. "\n  AND object_group = '" . $db->getEscaped($comment->object_group) . "'"
. (JCommentsMultilingual::isEnabled() ? "\nAND lang = '" . JCommentsMultilingual::getLanguage() . "'" : "")
;
$db->setQuery($query);
$found = $db->loadResult();
with
Code: (php)
$found = 0;

But this will decrease flood-protection on your site.
Logged

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

Karma: 0
Offline Offline

Posts: 2


Email
« Reply #2 on: October 04, 2010, 18:02:03 »

Thank you very much!

It works:)

I know it, but I use Jcomment in my K2 articlies like a "Like" system. No message form, just a send button, so users only send empty messages, and it appear on his profil(JS plugin) with the text that: Articles what this user like.


Sorry but I have another question(I promise the last one:)). Is there any possibilities that one user to an article comment only once?
« Last Edit: October 04, 2010, 18:03:50 by bgcs3 » Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #3 on: October 04, 2010, 18:09:50 »

In my mind this feature could be implemented via custom plugin for JComments - it could use onBeforeCommentAdded event to block comment's saving if any comment from this user already exists.
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    General discussion    Topic: Same Comment
 
Jump to: