Home › Toolset Professional Support › [Resolved] CRED – using data (ID etc.) of the created post in success message
Problem:
The issue here is that the user wanted to display the created post ID on their form submission message.
Solution:
Unfortunately this seems not to be possible however the user opted to redirect to the page that was created using CRED by using the following hook
//redirect after post creation add_filter('cred_success_redirect', 'custom_redirect',10,3); function custom_redirect($url, $post_id, $form_data) { if ($form_data['id']==150) //Change this to your form's ID //Get that Post's Permalink of Target Page $permalink = get_permalink(130); //Return the URL to where to redirect: return $permalink."?created_post_id=".$post_id ; return $url; }
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 |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Content-submission forms, CRED API, Toolset Forms
Related documentation:
This topic contains 3 replies, has 2 voices.
Last updated by KonstantinS88 6 years, 7 months ago.
Assisted by: Shane.
When I create a new post with a CRED form I want to have a link that contains the ID of the just created post. useable within the text message.
How can I use the ID of the created post in the message form? All I got so far is the ID of the page the CRED form is inserted in.
The reason I want to acchieve this is that I want to have a link in the message guiding to another cred form with the ID of the created post (of the first cred form) set as a url parameter for a preselected parent. meaning: You have to create the "object" (a bolok for example) first and can then directly "review" it.
Thanks in advance.
Hi Konstantin,
Could you try adding this attribute to the shortcode and let me know if it works.
id='%%POST_ID%%'
Thanks,
Shane
Unfortunately this returns a 0 when used in a shortcode and just %%POST_ID%% when used inside a standard a link.
Guess this is not possible which I wonder about a little. Tried everything . Even used the cred message shortcode. Fininally I did something else:
//redirect after post creation add_filter('cred_success_redirect', 'custom_redirect',10,3); function custom_redirect($url, $post_id, $form_data) { if ($form_data['id']==150) //Change this to your form's ID //Get that Post's Permalink of Target Page $permalink = get_permalink(130); //Return the URL to where to redirect: return $permalink."?created_post_id=".$post_id ; return $url; }
Nonehtless, I feed like the "created post ID" should defginitely be available in the feedback message.