Skip to content
Comments module for Yii framework
PHP JavaScript
Find file
New pull request
Fetching latest commit...
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
assets fixed bug with enter button in "Add comment" dialog.
controllers Added access to controller action based on admin expression
messages Added spanish message translations
models fixing error: Integrity constraint violation: 1052 Column 'create_tim…
CommentsModule.php Added access to controller action based on admin expression
README Readme file for github with updated info.
readme.php Adding Comment table schema to readme


Yii module to add comments to any instance of CActiveRecord.

-Comments administration
-Threaded comments
-Each instance with their own configuration

To add a comment to the model, you need to perform the following steps.

Add Comments table to your schema:

    `owner_name` varchar(50) NOT NULL,
    `owner_id` int(12) NOT NULL,
    `comment_id` int(12) NOT NULL AUTO_INCREMENT,
    `parent_comment_id` int(12) DEFAULT NULL,
    `creator_id` int(12) DEFAULT NULL,
    `user_name` varchar(128) DEFAULT NULL, 
    `user_email` varchar(128) DEFAULT NULL,
    `comment_text` text,
    `create_time` int(11) DEFAULT NULL,
    `update_time` int(11) DEFAULT NULL,
    `status` int(1) NOT NULL DEFAULT '0',
    PRIMARY KEY (`comment_id`),
    KEY `owner_name` (`owner_name`,`owner_id`)

Configure the module in app config:

        //you may override default config for all connecting models
        'defaultModelConfig' => array(
            //only registered users can post comments
            'registeredOnly' => false,
            'useCaptcha' => false,
            //allow comment tree
            'allowSubcommenting' => true,
            //display comments after moderation
            'premoderate' => false,
            //action for postig comment
            'postCommentAction' => 'comments/comment/postComment',
            //super user condition(display comment list in admin view and automoderate comments)
            //order direction for comments
        //the models for commenting
            //model with individual settings
                //config for create link to view model page(page with comments)
            //model with default settings
        //config for user models, which is used in application

Display ECommentListWidget in view for displaying commentable models

$this->widget('comments.widgets.ECommentsListWidget', array(
    'model' => $model,

To manage all comments go to
Something went wrong with that request. Please try again.