Skip Navigation

[Resolved] Let the user edit the post right after submitting it with CRED

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I let the User edit the post with CRED, that he just submitted with CRED?
I want, after submitting the new post, that the user is redirected immediately to edit the post.

Solution:
https://toolset.com/forums/topic/passing-new-cpt-idslug-to-another-form/#post-580765

Relevant Documentation:
https://toolset.com/documentation/user-guides/creating-cred-forms/
https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

This support ticket is created 7 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 3 replies, has 2 voices.

Last updated by robertM-17 7 years, 1 month ago.

Assisted by: Beda.

Author
Posts
#580726

Tell us what you are trying to do?
I have a form that CREATES a NEW entry of a CPT. The CPT has many fields but the first CRED form is a Create Form that just contains 'Title' and 'Description' fields so user can Create that new Entry.

I'd like On Submit of the form
1) pass value of that NEW CREATION directly to another form/page. So User can then edit that new entry. Also to display the entry 'title' and 'description' on the Edit Form page.

Is there any documentation that you are following?
Trawled Forums, looked at urlparam stuff but can't figure out exactly. THere is so much

Thanks in advance

#580765

You already have your CRED form that creates the posts.
Great.

Now, create a CRED form that edits those posts.
In the setting of the form that creates what to perform after the form is submitted, please choose "Display the post".

Then, create a Content template for the posts, and in there, you can add a link to the Edit CRED form you just created.
https://toolset.com/documentation/user-guides/creating-cred-forms/

Or, if you want to call that form (edit post) directly after submit, then proceed like this:

- create a CRED edit form for those posts and place it on any page on your site.
- when you insert the CRED Edit form in this page, pass a specific post ID to be edited:

[cred_form form='edit-a-post' form_name='Edit a post' post='[wpv-search-term param="post_to_edit"]']

- in your CRED form that creates the posts, choose to redirect to a page after submit (does not matter what page)
- use the CRED API to redirect to the proper URL with a parameter in it. Example:

add_filter('cred_success_redirect', 'custom_redirect',10,3);
function custom_redirect($url, $post_id, $form_data)
{
    $url = '<em><u>hidden link</u></em>' . $post_id;
    return $url;
}

https://toolset.com/documentation/programmer-reference/cred-api/#cred_success_redirect

This will now redirect the user to the Edit Post form of the very post the user just submitted with CRED.

#581029

HI Beda

Thanks for the reply. The stuff on filters looks like just what I need and the docs are useful. I have yet to try and implement but I can see a way forward. I wanted to reply to ticket, so will just close it here and come back if I get stuck.

Thanks for pointing a clearer way through the jungle.

#592991

Ok thanks for this.
I've got Beda's original support guidance working now.
-I'd made a mistake in how the shortcode on the receiving form was written.

Can work with that for now.
Thanks Beda