Mecha CMS

Mecha CMS blog and documentation.

Custom Comment Status

Updated: Tuesday, 21 March 2017

Admin, guest and spam comments.

Maybe you don’t like with the default data of the comment status on this CMS which consists of pilot, passenger and intruder. If you prefer with the comment status data as how most other CMS use, then you can apply this filter:

Filter::add('comment:status', function($status) {
    return Mecha::alter($status, array(
        'pilot' => 'admin',
        'passenger' => 'guest',
        'intruder' => 'spam'
    ));
});

So that you can do something like this:

<div class="comment comment-<?php echo $comment->status; ?>">
  …
</div>
.comment {}
.comment-admin {}
.comment-guest {}
.comment-spam {}
Donation and Email Subscription