Draft button

Support MB Frontend Submission Draft buttonResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #37254
    YasmineYasmine
    Participant

    Hi Long,

    I promise this is my last question for a while 🙂

    I have replaced my submit button at the bottom of my MB frontend with a "save progress"[save as draft status] (it makes sense to change this one as its the one which always shows as navigating through the tabs), and then I created a new submit button in the final tab which only appears after the recommended fields have a value [to save as pending status].

    However, this setup does not work for editing the post. For example, if they click the "save progress" button (which I was hoping to conditionally change the text if post-status = pending or published to "update") then it reverts it back to draft status, and the custom made tab for "submit" button shows because those fields are filled after they completed their drafts - so it makes no sense when revisiting to edit.

    Is there a way to conditionally show buttons depending on post status. So if it is "published" then submit tab won't show and only a button to update the post. If pending, then only an option to update yet if draft then an option to "save draft" and "submit"

    Cheers,
    Yasmine

    #37271
    Long NguyenLong Nguyen
    Moderator

    Hi,

    When editing the post, there is a parameter in the URL pointing to the post ID and you can get the post status based on that value.

    $post_id = $_GET['rwmb_frontend_field_post_id'];
    $post_status = get_post_status( $post_id );

    then create an if statement to check the post status to show/hide the button.

    #37274
    YasmineYasmine
    Participant

    Perfect, thank you. Very clear.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.