Got it, thanks. I added this information to the wp-config.php file to bump up the memory allocation:
define('WP_MEMORY_LIMIT', '256M');
define( 'WP_MAX_MEMORY_LIMIT', '256M' );
- To prevent the critical error message, I've modified each of the 9-step forms to redirect to the Profile Completeness page for now, we can adjust later if necessary but please do not change yet.
- I've updated the functions.php file to include updated content template IDs for the redirects applied to each of the 9-step forms. They were previously set up to redirect to Form IDs, but those number should be Content Template IDs instead.
The URL where you can see the error is hidden link. It is with the completeness form where I am also getting the error on when I am trying the edit the form that will now a private status with the user roll just as peg editor.
Lots of issues here. First let's address the form / post type mismatch error. It's related to the fact that no post was specified for the Edit Form, and the Form is displayed out of context. To fix that, I've created a custom shortcode that can be used to determine the current User's Editor Profile post ID. The custom shortcode will return 0 if no Editor Profile post is found for the current User. Here is the code, I have already added it to the functions.php file:
// Toolset Support reference: https://toolset.com/forums/topic/multistep-forms
// get the logged-in User's Editor Profile post ID
// used to inform Toolset's Edit Post Forms which profile should be edited
add_shortcode('current-user-editor-profile-id', function( $atts = [], $content='' ) {
if( !get_current_user_id())
return 0;
$ep_args = array(
'post_type' => 'editor-profile',
'post_status' => array('publish','pending','private','draft'),
'author' => get_current_user_id(),
'posts_per_page' => 1,
);
$ep_query = new WP_Query( $ep_args );
$ep_id = isset($ep_query->posts[0]->ID) ? $ep_query->posts[0]->ID : 0;
return $ep_id;
});
Next I registered current-user-editor-profile-id in Toolset > Settings > Front-end Content > Third-party shortcode arguments. That allows us to use this shortcode as an attribute in the edit post Form shortcode. I've updated the Edit Post Form shortcodes in each of the 9 "Editors profile completeness form" Content Templates to include the new shortcode pointing to the User's specific Editor Profile post ID, like this example in the first template:
[cred_form form='update-editors-profile-step-1' post='[current-user-editor-profile-id][/current-user-editor-profile-id]'][/cred_form]
You need a conditional around the Form, because an error will occur if no Editor Profile post exists for the current User. So I've added that conditional using the following conditional criteria:
NOT (
The result of [current-user-editor-profile-id] is equal to 0.
)
Basically this tests to see if the current User has an Editor Profile or not. If so, it will display the edit form. If not, nothing will be displayed.
Next I had to move my previously created Editor Profile post out of the trash to test the Form. So I moved it, and set the status again to Privately published.
After that, I was able to see the form as expected in the Profile completeness page (screenshot attached). I made a minor text adjustment and submitted the Form, and I was then redirected to see the next step form at the URL:
hidden link
So each time a step is submitted from here, the URL will update to include the content template ID containing that step form.
I will change the registration form back to the previous setting just with the private status. If you then run it you will see it works. It is actually with form 2 that we are getting the error. I have just double-checked and I am getting errors now on both the forms.
I'm not sure I understand what should happen after the User submits New Editors Form Step 1. Should they be redirected to see New Editors Form Step 2? If not, what should they see immediately after submitting New Editors Form Step 1? Please explain.