Open mdnamarie opened 2 years ago
A simplified way to reproduce this issue:
foreach($page->children as $child) {
echo $child->comments->renderAll();
}
This results in duplicate ID attributes in the page source. And when any one comment form is submitted all the forms get processed and the submitted comment usually isn't connected to the correct child page. Could the hidden page_id
field be used to correctly connect the submitted comment to its page?
Short description of the issue
I have been rendering on one parent page all children pages (parent page template: group/ children pages template: group-post). The children are using a system of comment from the FieldTypeComments module, that is displayed on the parent page. All setting seem to be ok (see Optional: Screenshots/Links that demonstrate the issue) but new comments added appear on the last child created.
Expected behavior
I have been working on a website that has groups, in each group members can post images, youtube video url or plain text that will create a new child to the group (group-post). For each child (group-post) users can also respond to someone else's post, hence those page children have the comment field from FieldTypeComments module. The pages having the group-post template aren't supposed to be accessed directly, only the page having the group template.
Actual behavior
When there are multiple comment forms relating to different pages all rendered on the same page, the comments get the page_id from the last form on the page instead of the actual page_id value from the comment form.
Optional: Screenshots/Links that demonstrate the issue
https://processwire.com/talk/topic/27169-fieldtypecomments-how-to-comment-from-parent-page/#comment-224273
Way of calling children from the group template:
Comment forms with their page ID being set in the hidden page_id field of the comment form:
renderSuccess function redirect url as it should : http://localhost:888/groups/group/group-post-id-1218/?comment_success=1&comment_approved=1#Comment68
acutal behavior:
Steps to reproduce the issue
Setup/Environment