CComment docs


The settings.php file should contain a class with a name following the convention ccommentComponent NAMEOFCOMPONENT Settings . The class should extend ccommentComponent settings. The only function that this class should implement is the getCategories function. This function should return an array of objects with id & title. Those objects will be shown on the settings screen in the backend and the user will be able to select the categories where CComment is allowed.

Categories selection in the backend

Let us look at an example:

class ccommentComponentContentSettings extends ccommentComponentSettings
     * categories option list used to display the include/exclude category list in setting
     * must return an array of objects (id,title)
     * @return array() - associative array (id, title)
    public function getCategories()
        $db = JFactory::getDBO();

        $query = $db->getQuery(true);
        $query->select('id, title');
        $query->where('published = 1');
        $query->where('extension = ' . $db->quote('com_content'));
        $query->order('title ASC');

        $options = $db->loadObjectList();

        return $options;


The above code is the content of settings.php for com_content. As you can see the ccommentComponentContentSettings extends the ccommentComponentSettings class and implements the getCategories function. If the component that you are integrating CComment with doesn't support categories, then you can just create the Class without implementing the getCategories function. In this case we will use the getCategories function from the parent class that returns an empty array.