Closed jenstornell closed 7 years ago
Custom fields (#23) are soon coming to a Kirby Comments plugin near you.
You can now use custom fields with Kirby Comments. Add this code to your config.php:
c::set('comments.custom-fields', array(
array(
'name' => 'stars',
'title' => 'Stars',
'required' => true, // you decide, default is `false`
'validate' => function ($value, $page) {
$intval = intval($value);
return $intval >= 1 && $intval <= 5;
},
'sanitize' => function ($value, $page) {
return intval($value);
}
)
));
and this code into your custom comments form. (If you don’t have a custom comments form, simply copy the one from this plugin in snippets/comments-from and add the line.)
<input name="stars" value="<?php echo $comments->customFieldValue('stars') ?>" type="number" min="1" max="5" step="1">
I'm quite spammy today. That's because I will implement a comment system very soon to the site I've made a redesign for.
I will choose some of these:
I hope your plugin will win.
Back to the issue. Is it possible to add ratings like stars? Maybe just be able to add an extra select form field that contain 1-5 ratings?