Move page to another folder from the frontend

Hey!

I’m looking for a way to move a page from a folder to another one directly from the front end, using a form to select the page.

The idea is that, when a page is selected (with its title for example) and sent trough the form, the page goes from one folder to another. (or at least lose its visibility), to be sure other user dont see it.

It’s for a birth gift list, so i need to find a way to avoid the same gift from two friends. :smile_cat: Making old gift in another folder would let me show those as archived gift for example.

Any idea ? Thanks!

Kirby doesn’t let you move pages to another folder. This seems like a simple problem, but it ends up having lots of unforeseen consequences: https://github.com/getkirby/panel/issues/67

Could you handle this problem by having a checkbox field on each gift, to track whether it’s been given already?

Ok got it. Thanks!

I’m thinking of adding a small form next to the checkbox with the name of the buyer too, or a already-bought tag or whatever, this seems simple.

What i need to understand is how you can change content from the front end because i think things will happen this way: friend come to the site, and select a gift, enter his name, and the gift disappear (or go somewhere else).

btw, nice work with shopkit, :smiley:

1 Like

Maybe you don’t need to move the page but only change the content, like adding a value if it’s old and then check that value on the next try?

status: old

Then you would need this function:

https://getkirby.com/docs/cheatsheet/page/update

Interesting!

Not sure i get how it work though.

I understand it this way: the update should be happening after a click on a validate button (for example). But how do you call that function?

But i’m searching this way.

Thanks a lot!

Have a look at this cookbook recipe: https://getkirby.com/docs/cookbook/creating-pages-from-frontend

It’s about creating pages from frontend, but you might as well call the $page->update() method instead of creating a new page.

1 Like

You’ve got a cookbook page for everything? :wink:

1 Like

I wish I had, but maybe I’ll get there one day :wink:.

2 Likes

A little off topic but…

…if that happends you could be replaced by a clever bot in the future: https://lmgtfy.com/?q=kirby+create+pages+frontend

:wink: But let’s keep you around for at least another 10 years or so. :slight_smile:

1 Like

Hey that’s not fair! i looked on duck duck go (sorry, cant fo on with google) how i should do it, but i could not find the way to create content in any other way than using the panel or txt files in the ftp).

And if @samnabi and @texnixe and you @jenstornell , i would still be out there looking for a solution.

Google can’t replace nice people. Never.

I found the way to do what i needed to do. still need some time to find the best way to do it. Thanks all of you!

2 Likes

other than that if you really need to move a folder, you could still use toolkit:

https://getkirby.com/docs/toolkit/api/dir/move

1 Like

so this is possible. I’m trying with the checkbox and the update function, but then i’ll check this one.

thanks a lot!