diff --git a/README.md b/README.md index 234b876..2fb1b92 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,6 @@ A Kirby comment plugin -**Please be aware, this is still a beta.** - ## Features - ✅ Receive comments from a form on your site @@ -20,6 +18,10 @@ A Kirby comment plugin - Moderate komments on your page - Disable/enable komments per page - ✅ Disable komments after a certain number of dates in relation to the publish date +- ✅ Reply to comments +- ✅ Verified badge for logged in users + +**As of version 0.10.0 the split view is the default view** The mixed view is deprecated due to the new nested comments functionality. ![the dashboard](doc-assets/komments-dashboard.png) (The komment dashboard) @@ -40,10 +42,6 @@ After Installing the Plugin add the snippet to your template. There are two snip To list all komments and webmentions: -`` - -To list komments and webmentions separated from each other: - `` To show the komment form @@ -114,6 +112,8 @@ You can fine tune the komments to behave as you whish, use this options in `conf | `komment-icon-reply` | '💬' | The icon for replies/comments in your komment list | | `komment-icon-repost` | '♻️' | The icon for reposts in your komment list | | `komment-icon-mention` | '♻️' | The icon for mention in your komment list | +| `komment-icon-verified` | '✅' | The icon for the verify badge list | +| `replyClassNames` | '' | add classnames tto the reply link | **Please make sure to prefix all the options with `mauricerenck.komments.`**. For example the debug option should be set in your `config.php` like so: `'mauricerenck.komments.debug' => true` diff --git a/blueprints/sections/komments.yml b/blueprints/sections/komments.yml index bf56b32..4489a22 100644 --- a/blueprints/sections/komments.yml +++ b/blueprints/sections/komments.yml @@ -48,7 +48,7 @@ fields: kommentType: type: select label: Type - width: 1/3 + width: 1/4 options: LIKE: Like REPOST: Repost @@ -60,11 +60,15 @@ fields: type: date label: Published time: true - width: 1/3 + width: 1/4 status: type: toggle label: Status - width: 1/3 + width: 1/4 + verified: + type: toggle + label: Verified + width: 1/4 columns: author: width: 1/4 diff --git a/config/options.php b/config/options.php index 1c7c2dd..3888030 100644 --- a/config/options.php +++ b/config/options.php @@ -22,4 +22,6 @@ 'komment-icon-reply' => '💬', 'komment-icon-repost' => '♻️', 'komment-icon-mention' => '♻️', + 'komment-icon-verified' => '✅', + 'replyClassNames' => '', ]; diff --git a/config/translations.php b/config/translations.php index a332df7..164321e 100644 --- a/config/translations.php +++ b/config/translations.php @@ -17,6 +17,7 @@ 'mauricerenck.komments.headline.reposts' => 'Shares', 'mauricerenck.komments.headline.mentions' => 'Mentions', 'mauricerenck.komments.headline.replies' => 'Replies', + 'mauricerenck.komments.action.reply.text' => 'reply', ], 'de' => [ 'mauricerenck.komments.liked' => 'hat ein like spendiert', @@ -32,5 +33,6 @@ 'mauricerenck.komments.headline.reposts' => 'Geteilt', 'mauricerenck.komments.headline.mentions' => 'Erwähnungen', 'mauricerenck.komments.headline.replies' => 'Antworten', + 'mauricerenck.komments.action.reply.text' => 'antworten', ] ]; diff --git a/index.php b/index.php index 4f60762..bf370da 100644 --- a/index.php +++ b/index.php @@ -148,7 +148,8 @@ return new Response('
Invalid field values
', 'text/html', 412); } - $newEntry = $kommentReceiver->createKomment($webmention, $spamlevel); + $isVerified = (!is_null(kirby()->user())) ? kirby()->user()->isLoggedIn() : false; + $newEntry = $kommentReceiver->createKomment($webmention, $spamlevel, $isVerified); $kommentReceiver->storeData($newEntry, $targetPage); $kommentModeration->addCookieToModerationList($newEntry['id']); diff --git a/snippets/kommentform.php b/snippets/kommentform.php index 7cd1a0e..9e6ee5b 100644 --- a/snippets/kommentform.php +++ b/snippets/kommentform.php @@ -1,8 +1,17 @@ +kommentsAreEnabled()): ?> + + + kommentsAreEnabled()): ?> - - - + $formName = ''; + $formEmail = ''; + $user = $kirby->user(); + + if (!is_null($user) && $user->isLoggedIn()) { + $formName = $user->name(); + $formEmail = $user->email(); + } +?> \ No newline at end of file diff --git a/utils/base.php b/utils/base.php index a1060dc..c4cd3cb 100644 --- a/utils/base.php +++ b/utils/base.php @@ -100,6 +100,7 @@ private function transformToReply($komment) 'wmsource' => $komment->wmsource()->value(), 'wmtarget' => $komment->wmtarget()->value(), 'wmproperty' => $komment->wmproperty()->value(), + 'verified' => $komment->verified()->value(), 'replies' => [] ]; } diff --git a/utils/receiveKomment.php b/utils/receiveKomment.php index 9d846e0..a2230f0 100644 --- a/utils/receiveKomment.php +++ b/utils/receiveKomment.php @@ -22,7 +22,7 @@ public function storeData(array $newEntry, $targetPage) ]); } - public function createKomment($webmention, $spamlevel = 0) + public function createKomment($webmention, $spamlevel = 0, $isVerified = false) { return [ 'id' => md5($webmention['target'] . $webmention['author']['name'] . $webmention['published']), @@ -39,6 +39,7 @@ public function createKomment($webmention, $spamlevel = 0) 'kommentType' => $webmention['type'], 'status' => $this->setStatus($webmention['type']), 'spamlevel' => $spamlevel, + 'verified' => $isVerified ]; }