Sorry, i wasnât home. So for me, the code works. Just some guesses: There is a problem with your pages, therefore the comments page cant be created and createChild on null is, where it ends.
It could also be a permissions problem.
about texnixes issues:
â Thatâs true, for me it still works
â I copied everything from kirby 2 code, thats correct. However for my use case, it does work. But i have two versions now, one customized at my website and the public one, so they could slightly differ.
â Jupp thats true. Since i quickly needed something that works and i wonât by myself actively maintain this plugin (however merge requests are always welcome), i made the bare minimum to get it done.
Still thank you @texnixe for your investigations. I will update this soon.
Thanks @RastaTux â I wonder if a clean install of Kirby 3 vs your upgrade makes any notable difference to the fact that yours is working and Iâve been unable to get this to work cleaning. I might give that a go as frankly, Kirby 3 is going to be much easier for what Iâm trying to pull off.
@cadler No, without the fixes it canât possibly work unless you apply the suggested fixes yourself.
Having said that, you could work around the issue by auto-creating a comments subpage every time an article (or whatever it is where you the comments to appear) is created following this recipe: https://getkirby.com/docs/cookbook/extensions/subpage-builder
Ough okay, sorry you were right. Actually it worked for me, because since i had already the âcommentsâ folders due to moving everything over from an kirby v2 page, i didnât get this error. I changed the things from @texnixe, however the âcommentsâ page were created as draft.
I added $comments_page->publish(); and it gets created, but the _drafts folder and the old version are not getting deleted. I guess, itâs something about file permissions⌠Do you have an idea how to fix that? Actually i had always problems with permissions with kirby commentsâŚ
You beat me to the punch @RastaTux â iâve been trying to figure this â/_draftsâ folder out and how to get it out of draft mode. Did the $comments_page->publish(); work, and if so where are you placing this in the file?
Hi @texnixe â Iâve followed the Subpage Builder instructions applied to this project and it doesnât seem to work. Something about the instructions leads me to believe itâs incomplete (not simply because my implementation isnât working )
It seems that it runs into a loop if the blueprints you use in your subpage builder do not exist, so that it uses the default template. Apart from that issue the code works for me.
Regarding the Subpage Builder feature, and to set the stage, Iâve posted some screengrabs of the relevant pages below.
But essentially, the directory and page is not created when I create a new âCritiqueâ page.
Iâm also running into the same issue as @RastaTux above ("/_drafts/" is a directory created for comments and as such the comments donât get published.
So it seems like two issues are holding me back:
A directory called â_draftsâ is being created by the comments plugin, but is either not being updated to â/comments/â as a subdirectory. In my situation Iâd ideally skip the whole âpreviewâ step and there would never be a â_draftsâ directory.
The Subpage builder does not create a subpage. I was originally thinking this would create the â/comments/â directory and a âcommentsâ text file, but it seems it would just be the text file. So I might have been expecting something incorrectly here.
A return statement returns control to the calling script, everything that comes after is then ignored.
I already added this to the documentation a while ago (https://getkirby.com/docs/reference/system/options) because Iâve seen this error multiple times by now, but donât know where else to put it so it gets attention?
Unfortunately I donât have a great alternative suggestion regarding educating us more effectively on return statements / syntax.
As with any system, as it becomes more complex, more documentation is necessary, all driven by more use cases⌠resulting in it becoming harder to access all information as an individual user trying to educate themselves on a the system in service of achieving their goal.
We deal with somewhat the same issue with Kickstarter, though clearly different context and circumstance.
Hey!
The problem with using subpage builder - It needs changes on the above blueprint. Itâs something that the plugin should do by itself without the need to change blueprints that have nothing to do with the comments plugin. Is there another solution?
As i said, i also tried to $comments_page->publish(); the comments page, but its not removing the _drafts folder. I guess it has something to do about permissions. If we could solve this, it would be a way cleaner solution imhoâŚ
At least for me @texnixe solution does work, though now it seems once the comment is rendered to the page, the form does not render. So thatâs my current challenge to pursue.
Still curious @RastaTux which file and line youâre applying â$comments_page_publish();â .
Fantastic! Thanks. Got that squared away, and also included a <?php $_POST = array(); ?> to clear the form upon refresh allowing for an ease of multiple comments by contributors.