Hi, wondering what options there are for a user to change a status of a post on the frontend using Frontend Submit. We are using Oxygen to display CPTs in a repeater. What we'd ultimately want is a way for a user to change a post to a custom status called 'accepted' which we already have set up. Is there a way to use one of the helper functions to accomplish that with just a simple button click, or do we have to actually have a field that does this, similar to this answer.
I understand that getting the ID might be tricky, but I think I can handle that part. I am just looking for some direction on what to do once I have the correct post ID.
It can be done with a simple button click to save/change the post status but you will need more custom code to do that, not with just the helper function and form hooks.
If you are not familiar with coding, you can create a service request here https://metabox.io/contact/, our development team will help you with an extra fee.
We were able to accomplish this another way, thank you for your help!
What was your workaround? Did you manage to do with a button (rather than a switch) ?
Like Yasmine, I would also like to know how you accomplished this.
So we ended up adapting the idea Long gave us in Gravity Forms rather than Meta Box, as we needed to use notifications to notify users when this happened. Basically, we set up a gravity form that was just the submit button and a hidden field. In the hidden field, we used Gravity Forms' Dynamic Population feature to pull in the post ID. Then we used the
gform_after_submission hook to update the post's status on submit, using the ID as the method of getting the post.
This is just a surface level explanation, as our use case is actually a lot more complicated than this, so I can't just post the code.
Here is a stripped-down example of what I did, it is untested, but it should work just the same.
This details how you would do the
after_submission hook. The dynamic population feature is the first step, but how you implement that will depend on your project. All that matters is you need to get that ID in the hidden field before anything will work.