NO display of stars on and star off images in Comments plugin

Create issue
Issue #23 resolved
Manu Saxena created an issue

Hi, I am new to october cms, and I installed the comments plugin. I have an issue and a query regarding the plugin.

A. Issue 1. The rate system is not displaying the star on and star off png images. Kindly provide the solution for this. issue.JPG

B. Query 1. Can I change the time format, the plugin is displaying date format. I want the format to display, how long ago the comment was posted.

Regards Manu

Comments (5)

  1. Alexey Sozonov repo owner

    Can you check paths to images? It should be /plugins/xeor/comments/assets/images/star-off.png

  2. Alexey Sozonov repo owner

    You need to add custom Twig filter. I use this function for an example.

    Create new plugin from Rainlab.Builder and add this code to Plugin.php

     public function registerMarkupTags()
            return [
              'filters' => [
                'time_ago' => [$this, 'timeAgo']
        public function timeAgo($datetime)
            $time = time() - strtotime($datetime);
            $units = array (
              31536000 => 'year',
              2592000 => 'month',
              604800 => 'week',
              86400 => 'day',
              3600 => 'hour',
              60 => 'minute',
              1 => 'second'
            foreach ($units as $unit => $val) {
                if ($time < $unit) continue;
                $numberOfUnits = floor($time / $unit);
                return ($val == 'second')? 'a few seconds ago' :
                  (($numberOfUnits>1) ? $numberOfUnits : 'a')
                  .' '.$val.(($numberOfUnits>1) ? 's' : '').' ago';

    Then you need to override default comment partial

    <small class="comment-published-at">{{ comment.created_at|time_ago }}</small>
  3. Manu Saxena reporter

    Thanks. Yes the images are there in the specified paths. But I still faced the problem. I tried to find a solution of mine. I've changed the path in the file "plugins/xeor/comments/assets/js/xeor.comments.js" line 79 and line 247 path: '/ProjectName/plugins/xeor/comments/assets/images',

    Now its working fine after adding the Project name in the address. The stars are shown. Please confirm if I did the right thing.

  4. Alexey Sozonov repo owner

    It's very strange that you use /ProjectName/plugins/ path. Did you install your app in subfolder? You also can overwrite js file. Just copy it to /themes/YOURTHEME/partials/comments/ folder.

  5. Log in to comment