vjCommentPlugin - 1.0.2

Comment behavior + comment's administration

You are currently browsing
the website for symfony 1

Visit the Symfony2 website

« Back to the Plugins Home


Forgot your password?
Create an account



advanced search
Information Readme Releases Changelog Contribute
Show source


This readme presents briefly how to use this plugin.

A presentation of the plugin is available here.


  • Install the plugin

    $ symfony plugin:install vjCommentPlugin
    $ symfony plugin:publish-assets
    $ symfony cc

How to make something commentable ?

Add behavior in your schema

  • edit config/doctrine/schema.yml

        # others behaviors

Build your project

  • It's a new project (you don't have build all, so do it !)

    $ symfony doctrine:build --all
  • It's an old project (you created it before this plugin :p), I've tried migration but it seems to be a problem with behavior in migration so you'll need to rebuild your model ...

    $ symfony doctrine:build --all

Activate module in frontend

  • edit apps/your_frontend_app/config/settings.yml

    enabled_modules:        [..., comment]

Add the form and/or the list of comments wherever you want

  • edit your action file

    public function executeIndex(sfWebRequest $request)
      $this->news = Doctrine::getTable('News')->find($request->getParameter('id'));
  • edit your template file

    <?php include_component('comment', 'formComment', array('object' => $news)) ?>
    <?php include_component('comment', 'list', array('object' => $news, 'i' => 0)) ?>

And ... that's all ! You only need to get your object and to pass it to the template and two components do the rest.

How to enable reCaptcha

You need to enable it in each frontend application

  • edit apps/your_frontend_app/config/app.yml

        enabled:        true
        # visit http://recaptcha.net/
        public_key:     your_public_recaptcha_key
        private_key:    your_private_recaptcha_key

How to disable or param Gravatar

Gravatar is enabled by default, to disable it

  • edit apps/your_frontend_app/config/app.yml

        enabled:        false

You can change default size or default image of gravatar

  • edit apps/your_frontend_app/config/app.yml

        default_size:   40
        default_image:  ../web/images/gravatar_default.png

How to moderate comments and/or reports ?

Activate modules in backend

  • edit apps/your_backend_app/config/settings.yml

    enabled_modules:        [..., commentAdmin, commentReportAdmin]

Moderate comments You can edit a comment, reply to or delete one. Deletion is not permanent ; the comment appears in frontend with the mention 'deleted by moderator'. You can restore it. Reply in backend is same as reply in frontend. You can use the user object to override author values in the form.

Moderate reports You can remove, validate or invalidate a report and edit or remove a comment. There's three states : untreated, validated and invalidated. By default, list only shows untreated reports. You can switch in filters.

How to disable or param Gravatar

In the list of the commentAdmin module, comment's body is truncated to 50 characters by default to keep a readable list. You can edit this option :

  • edit apps/your_frontend_app/config/app.yml

        max_length:     50


English (default) and French translations are embed in the plugin.

To use french :

  • edit apps/your_apps/config/settings.yml

    default_culture:        fr #en
    i18n:                   true
  • edit apps/your_apps/config/app.yml

      culture_locale:  fr_FR.utf8
  • edit apps/your_apps/config/factories.yml

        class: myUser
  • edit apps/your_apps/lib/myUser.class.php

    class myUser extends sfBasicSecurityUser
      public function setCulture($culture)
        setlocale(LC_TIME, sfConfig::get('app_culture_locale'));
  • copy the generator.yml files

    $ cp -r plugins/vjCommentPlugin/more/modules/fr/commentAdmin/ apps/your_backend_app/modules/
    $ cp -r plugins/vjCommentPlugin/more/modules/fr/commentReportAdmin/ apps/your_backend_app/modules/
    $ symfony cc
  • don't forget to delete your cookies !


  • Integrate the tests provided


Please contact me if you see a problem, an error or if you think that something can be enhanced ! Advice are cool too !