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: Disable adding comments for a certain article
Pages: [1]   Go Down
  Print  
Author Topic: Disable adding comments for a certain article  (Read 2042 times)
0 Members and 2 Guests are viewing this topic.
chgeorge
Newbie
*

Karma: 0
Offline Offline

Posts: 2


« on: April 27, 2010, 16:31:16 »

Hello!

I have an article where my registered users can add comments. Now, is there a way to keep those comments readable but disable adding new ones? Meaning, remove the text box, submit button etc. I tried the "jcomments off" but this option removes the comments.
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #1 on: April 27, 2010, 17:12:32 »

This is very easy, just insert into article's text tag: {jcomments lock}, after this already old comments will be available for view but posting new comments will not be available
Logged

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

Karma: 0
Offline Offline

Posts: 2


« Reply #2 on: September 18, 2010, 07:25:22 »

Did you notice that users are still able to post comments even when you insert {jcomments lock} into the article?

They can still reply to other comments using the "Reply" / "Reply with quote" button...
Logged
smart
Administrator
Hero Member
*****

Karma: 160
Offline Offline

Gender: Male
Posts: 2559



WWW
« Reply #3 on: September 20, 2010, 14:47:40 »

This is known bug and it already fixed in upcoming version. Here is quick fix. More correct solution will come with new version.

Open file /components/com_jcomments/jcomments.class.php and replace code:

Code: (php)
function canQuote($obj=null)
    {
        if (is_null($obj)) {
            return $this->canQuote;
        } else {
            return ($this->canQuote&&(!isset($obj->_disable_quote))) ? 1 : 0;
        }
    }

    function canReply($obj=null)
    {
        if (is_null($obj)) {
            return $this->canReply;
        } else {
            return ($this->canReply&&(!isset($obj->_disable_reply))) ? 1 : 0;
        }
    }
with
Code: (php)
function canQuote($obj=null)
    {
        $config = & JCommentsFactory::getConfig();
        $commentsLocked = ($config->getInt('comments_locked') == 1);

        if (is_null($obj)) {
            return $this->canQuote && !$commentsLocked;
        } else {
            return ($this->canQuote && !$commentsLocked && (!isset($obj->_disable_quote))) ? 1 : 0;
        }
    }

    function canReply($obj=null)
    {
        $config = & JCommentsFactory::getConfig();
        $commentsLocked = ($config->getInt('comments_locked') == 1);

        if (is_null($obj)) {
            return $this->canReply && !$commentsLocked;
        } else {
            return ($this->canReply && !$commentsLocked && (!isset($obj->_disable_reply))) ? 1 : 0;
        }
    }
Logged

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

Karma: 0
Offline Offline

Posts: 2


« Reply #4 on: September 20, 2010, 17:07:47 »

OK, just wanted to let you know. Wink

Thanks for the fix!  Cheesy
Logged
fleischwolf3
Newbie
*

Karma: 0
Offline Offline

Posts: 5


« Reply #5 on: December 07, 2011, 00:09:47 »

Hi, I am using jcomments 2.2.0.2 and applied this fix but to no avail. The message "This content has been locked. You can no longer post any comment." is displayed but users are still able to reply, reply with quote and quote.
Any ideas what might be the problem?

Edit: Seems to have been a cache-problem, solved now, the provided fix works just fine!
Sorry for bothering you and thank you!

Best wishes,
fw

Edit2: It is still a cache issue. The fix does not work if in global config cache is turned on.
« Last Edit: December 07, 2011, 08:17:30 by fleischwolf3 » Logged
Pages: [1]   Go Up
  Print  
JoomlaTune Support Forum    JComments component    General discussion    Topic: Disable adding comments for a certain article
 
Jump to: