Startseite › Toolset Professional Support › [Gelöst] 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.
Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.
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)
Verwandte Dokumentation:
Dieses Thema enthält 3 Antworten, hat 2 Stimmen.
Zuletzt aktualisiert von KonstantinS88 vor 6 Jahren, 7 Monaten.
Assistiert von: 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.