Hi, thank you for that nice module...whitout needing the "big" rules module.

I have installed the module, limit the comments count to 1 per node, but the user can't EDIT the comment...
(working local on drupal 8.1.10 - php 7.0.8 - MySQL 5.5.42)

Do you have any solution?

Thanks in advance!

Comments

NerdyCrowd created an issue. See original summary.

daiwik.addweb’s picture

StatusFileSize
new593 bytes

Apply following patch to make things work flawlessly.

daiwik.addweb’s picture

Status: Active » Needs review
didebru’s picture

Hey @NerdyCrowd thanks for your kind words.

Did you set the permission to the user that should edit their own comments?

Because this permission isn't set by default.

didebru’s picture

+++ b/comment_limit.module
@@ -80,8 +80,11 @@ function comment_limit_form_comment_form_alter(&$form, FormStateInterface $form_
+  if(is_object($field_config)) {
+    $field_id = $field_config->id();

Why we don't check if it is a instance of Drupal\field\Entity\FieldConfig

instead of is_object?

And of course get rid of that ugly php notice :)

johnnydarkko’s picture

StatusFileSize
new670 bytes

Rerolled patch with `instanceof` instead of `is_object` as suggested in #5. Also cleared a couple of undefined errors for $field_id and $field_label.

ivnish’s picture

del

johnnydarkko’s picture

Status: Needs review » Closed (outdated)
Related issues: +#3025007: Undefined variable error appear while editing comment

I was getting a bunch of php warnings of missing indexes for various entity types. This approach seems outdated, but the patch in this other issue appears to address the problem for me: https://www.drupal.org/project/comment_limit/issues/3025007

ivnish’s picture

Status: Closed (outdated) » Active

I reopened this temporary. Needs test after commit this patch https://www.drupal.org/project/comment_limit/issues/3025007

ivnish’s picture

Status: Active » Closed (works as designed)