getgrav / getgrav/grav-plugin-comments
Number of comments limited, moderation field implemented, still not working properly on modular (child) pages
- Dominant language
- PHP
- Stars
- 54
- Forks
- 26
- PR merge metrics
- No merged PRs in 30d
Description
Thanks for the plugin. I really like it.
* After some starting problems I managed to get it working on my blog pages on a stable basis (which includes regular cache clearing of my site).
* Did some enhancements:
* Limited the number of shown comments to e. g. 10
* Implemented a "moderated" field to be able to control which comments are shown or not
* Despite all efforts to get it working on modular subpages it won't work properly:
* The comments are shown on the modular, not on the subpage
* the path "/projekte#subpage" is changed to "/projekte/_subpage"
* My guess: it is about the "action="…" definition
For now I have no clue what to do next. Help/ideas are heartely welcomed!
Below please find my adapted comments.html.twig:
{% if enable_comments_plugin %}
{% set scope = scope ?: 'data.' %}
{{'PLUGIN_COMMENTS.ADD_COMMENT'|t}}
Mit der Nutzung erteilen Sie uns Ihre Einwilligung zur Speicherung und Verarbeitung Ihrer Daten (Datenschutzerklärung). Ihr Kommentar erscheint erst nach Freigabe. Schauen Sie daher später noch einmal herein.
{% for field in grav.config.plugins.comments.form.fields %}
{% set value = form.value(field.name) %}
{% if field.evaluateDefault %}
{% set value = evaluate(field.evaluateDefault) %}
{% endif %}
{% if config.plugins.login.enabled and grav.user.authenticated %}
{% if field.name == 'name' %}
{% elseif field.name == 'email' %}
{% else %}
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
{% endif %}
{% else %}
{% include "forms/fields/#{field.type}/#{field.type}.html.twig" %}
{% endif %}
{% endfor %}
{% include "forms/fields/formname/formname.html.twig" %}
{{ nonce_field('form', 'form-nonce')|raw }}
{% if grav.twig.comments|length %}
{{'PLUGIN_COMMENTS.COMMENTS'|t}}
{% for comment in comments|array_reverse|slice(0,10) %}
{% if comment.moderated == true %}
{% endif %}
{% endfor %}
{{comment.text}}
({{comment.date|e}} {{'PLUGIN_COMMENTS.BY'|t}} {{comment.author}})
{% endif %}
{% endif %}
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the adapted comments.html.twig shown in the issue, especially the form action using page.url, and reproduce submission on a Grav modular child page. Compare the generated URL and comment placement with a normal page; done means the form keeps the child-page path and comments are shown on that subpage rather than its parent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100