• Resolved dkirmis

    (@dkirmis)


    Can anyone tell me the best way to create a front-end form or list that allows a user to edit previous posts of a custom post type? I have a form that allows them to create posts from the front-end…I then want them to be able to go back and edit a specific post (or choose from a list of his own posts) to edit its contents.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Jim True

    (@jimtrue)

    If you’re using pods form shortcode, you can include the ID of the post to be edited and it will load that post in the form. Just include slug for the slug of the post or id for the id of the post.

    If you’re using pods form (https://pods.io/docs/code/pods/form/ in PHP, you just load the id as part of the pods object created when you call the form.

    Thread Starter dkirmis

    (@dkirmis)

    Sorry, I didn’t see this response before posting on the slack channel. This would be used if the user knows the slug or ID, right? But is there a way to show a list of the user’s posts and allow him to pick the title of the one that he wants to edit, and then bring up the form? I am close on this, I have the list created, just need to figure out how to click the title of the desired post and bring it up in a form.

    Plugin Contributor Jim True

    (@jimtrue)

    @dkirmis Sorry I missed your message above. You can mark tickets as ‘unresolved’ if you’ve still got a question.

    Typically what you would do is setup a ‘form’ as a shortcode on a page that will take the ID of the post to edit as a ‘Query Variable’, ie /edit-post/?my_id=7 . The Get or Query Variable would be ‘my_id’ and the value for that would be ‘7’.

    Then you can setup the form to use a where clause, where="ID = {@get.my_id}" using the Special Magic Tags. If this isn’t clear, please drop into our Slack Chat and I can probably explain it to you. ??

    Thread Starter dkirmis

    (@dkirmis)

    Jim, thanks so much for the follow-up. After I posted this, I went back to the Slack channel, and you answered my question there! So sorry I should have marked it as closed. My config was a little different because I had found a function to list the posts by the current user (kind of like a dashboard), and I wanted them to be able to click on one of them and edit it. So, I added an “Edit” link next to the title of the post and then you showed me how to use ?incident-id={@ID} in my template. It is working perfectly. Thanks for your awesome support!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘List posts for logged-in user’ is closed to new replies.