GermanEnglish

JComments fix for disabling comments in articles

There are no translations available.

Jcomments, the awesome free comment component for Joomla!, has also the possibility of disabling comments on a case by case basis. All you have to do is inserting "{ jcomments lock }" (without the spaces) in the article you want to disable the commenting function in.

However, the current version 2.2.0.2 has a bug: while the message "This content has been locked. You can no longer post any comment." is displayed users are still able to reply, reply with quote and quote. Smart, the mastermind behind jcomments, has provided a fix which I re-post here from the jcomments forums:

Find at around line 304 in components/com_jcomments/jcomments.class.php the following code:

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;
        }
    }

Replace this code with the following:

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;
        }
    }

and you're good.

Edit: In order for the fix to work you have to turn off the cache in global configuration.

You may send a trackback for this article by using the following Trackback link

Add comment


Security code
Refresh

Latest Comments

New Links

Data Driven Journalism
Stadtimker.de
The Political Compass
Great Artists' Mews

More...  

Short URL for this page
Banner
Copyright © 2012 VAGGI.( DE | EU ). All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
Template by RocketTheme Suchmaschinenoptimierung mit Ranking-Hits

This material is Open Content   Stop Spam Harvesters, Join Project Honey Pot   Creative Commons Attribution 3.0 Unported License   My-African-News.com   Jinja.eu - Home of the Source of River Nile - The East African Community Website   Vaggi.org_NGO-Directory/NRO-Verzeichnis_Sozialwissenschaftliche_OpenAccess_Zeitschriften/Social_Scientific_OpenAccess_e-Journals
Protected by Bot-Trap.de, Webseitenschutz
subdued