Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Deleted comment_body in content type, replaced by another new field and when posting comments there is error Notice: Undefined property: stdClass::$comment_body in function comment_submit() (string 2201 in file /modules/comment/comment.module).
If we use Permission private for the new field instead of comment_body, an authenticated user can't see it (admin can).
Comment | File | Size | Author |
---|---|---|---|
#6 | error-notice-on-delete-of-comment-body-field-2717717-7.patch | 1.17 KB | Vinay15 |
Comments
Comment #2
drusite CreditAttribution: drusite commentedComment #3
drusite CreditAttribution: drusite commentedComment #4
drusite CreditAttribution: drusite commentedComment #5
Vinay15Comment #6
Vinay15Hi there,
I have tried to fix this issue by creating this patch. Please let me know if this works.
Thanks,
Vinay
Comment #7
Vinay15Comment #8
Tritof CreditAttribution: Tritof commentedThe patch #6 worked for me. I'm using PHP7 on my server
Comment #9
markabur CreditAttribution: markabur commentedWorks for me.
D8 version of this issue: #2422353: Comment module should check that comment body field exists
Comment #10
Aporie#6 worked for me, thanks.
But now comments come without subjects : "(No subject)" whereas before they were trimming the comment_body to make one.
Comment #11
stefan.r CreditAttribution: stefan.r commentedComment #12
nickonom CreditAttribution: nickonom commentedThere is much older discussion and suggested solution on #1038652: Notices in comment_submit() and comment_admin_overview() when body field does not exist or is not required for this issue.