Closed jaro-io closed 1 year ago
I can't reproduce the issue on 4.0.0-alpha.5 (notes pages). Do you have any hooks or plugins?
@afbora hm, yes i have both. but i just removed all plugins
& hooks
and the issue still persists. however, you are right.. with a clean starterkit on v4
i can’t reproduce this, too.
any other ideas where this could be coming from? it’s definitely related to v4
, as it’s not happening in v3.9
. but also related to my setup, as it’s not happening with the starterkit.
🤷♂️ ✨
Could it be due to plugins that are not compatible with v4? Can you try to narrow down the source of the issue by disabling plugins and hooks one by one?
@afbora like i said, i already removed all my plugins
& hooks
. i also emptied my config
. it is still behaving the same. only one item gets unpublished. any other idea where this might be coming from?
I have no idea 🤷♂️ If it is in the github repository, we can test it by granting access 🤔
Closing for now. Feel free post new replicate info when you find more clues 👍
@afbora hm, i just tried this again with an empty starter kit. and i can easily reproduce the behaviour described above.
1. add code
add the following code to the photography.php
template.
foreach($page->children() as $child) {
$child->unpublish();
}
2. open template
open the /photography
page in the browser. it will look as if all children have been unpublished.
3. check panel when checking the panel, only the last child has been unpublished.
I can reproduce it. And it did work for me fine with v3 develop branch, but not v4.
After the first item is unpublish, the siblings are reordered and the root paths are updated. But since the paths of the other items in the loop are still outdated, when it comes to the second item, it cannot find root and the operation fails.
content/1_photography/1_landscape
content/1_photography/2_animals
content/1_photography/3_desert
content/1_photography/2_animals
content/1_photography/3_desert
content/1_photography/1_animals
content/1_photography/2_desert
description
i am facing a weir issue when trying to unpublish multiple pages with a simple
foreach
loop over the children of a page. inv3.9
this works perfectly fine. however, inv4
it only unpublishes the first page from the list. all other children stay published.i added some code to debug this and strangely with both
v3.9
andv4
the output (see below) is the same. so from the dump it seems like children are being unpublished fine. but then why is this not visible afterwards when refreshing the page in the panel? i tried checking the changelog forv4
but couldn’t find anything that seems to be related to this.expected behavior
i was expecting my code to have the same effect in both
v3.9
andv4
.screenshots
to reproduce
add the following code to a template. open a page with this template that has multiple children.
your setup
kirby version
4.0.0-alpha.5
console output