As it was really challenging task to work on you site - I've to setup a demo site.
Here is a sandbox site and you can auto-login to it using the following link:
- hidden link
As you can see I've created the custom role "Programmer":
- hidden link
Created User form "Add new programmer user" to register user:
- hidden link
Created all the post form for step 1,2 and 3:
- hidden link
Here is the page from where you can start registering:
- hidden link
As soon as you will register, it will redirect you on the following page:
- hidden link
As you can see in backend:
- hidden link
Where:
- under first conditional block I've added the post add form to add new book post
- under second conditional block I've added the edit post form to edit the existing post
[cred_form form='edit-book-step-1' post='[get_edit_post_id]']
And to get the edit post ID we use the custom shortcode: [get_edit_post_id]
- The custom shortcode is added to "Custom Code" section:
=> hidden link
add_shortcode('get_edit_post_id','func_get_edit_post_id');
function func_get_edit_post_id() {
$user_post = get_posts( array(
'post_type' => 'book',
'author' => get_current_user_id()
)) ;
$user_post_count = count($user_post);
if($user_post_count){
return $user_post[0]->ID;
}else{
return 0;
}
}
Also we register the custom shortcode name at: Third-party shortcode arguments
- hidden link
This is how the previous link is setup on "Edit book step 2" form:
=> hidden link
<div class="col-sm-4">
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button" href="/add-new-book">previous</a></div>
<!-- /wp:button -->
I hope this will get you the idea about how you can add previous button and get edit post id.