[Resolved] I need to implement a cred child notification
This thread is resolved. Here is a description of the problem and solution.
Problem: I would like to access the name of the page where my CRED form is included, in the post created by the CRED form. The page where the form is shown has no parent/child relationship to the post created by CRED.
Solution: Use a generic field in your CRED form to capture the current page ID. Use the page ID to get the page title, then update your post's meta information to include the page title.
add_action('cred_save_data', 'save_parent_title',10,2);
function save_parent_title($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==550)
{
if (isset($_POST['currentpageid']))
{
$parent_title = get_the_title($_POST['currentpageid']);
update_post_meta($post_id, 'wpcf-field-name', $parent_title, true);
}
}
}
This support ticket is created 7 years, 2 months 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have similar problem as described in this topic: https://toolset.com/forums/topic/cred-notification-2/
My problem change because i have a lot of parent post, not just only one.
I need to create a cred form to send a notification to the parent post author with the parent post title.
I' ve tried a lot of things (create a child post as in the topic, create custom post fields for parent post,use contact form 7 with dinamical ) but I can't not obtain the parent post title or the parent post email.
My example page is: hidden link. You can find the cred form in the sidebar.
First I must establish some context to see what has already been done 🙂
Does each Child have 1 parent ?
This is a One to Many relationship meaning that child posts can only have 1 parent correct? but the parent can have many children?
If this is so then we would need 2 views, one to display the parent Title and one for the Parent Author email. Also is the author email stored on the Parent post ?
Hi!!!!
I have diferent parents for one child....
I created different custom posts for different posts (parents).
After that i need to insert a cred form to send a direct notification to the post author and to me.
To do that, i followed the example that i mention in the last post.
I created a custom post (child) and custom fields. With that parameters I'd created a cred form and I inserted in the diferent posts, but I won't recieve the parent post title.
The problem to follow the post example is the need to insert a form value, but I can't do it for my different posts.
Is there a way to do it for all them?????
Sorry for my english, but if you go to the example page that I created you'll understand easy.
Yes, I need to send a message to the author post and in this message I have to insert post title too. The cred form I'd created is in part with title: Contactar.
In this part, someone who wants to contact with the author post can write his name, email and subject and send a message to the author with this three parametres + the title post (to know from which post is send this message).
But, this is just one post. I need all the posts created.
Thank you, but my problem isn't solve.
The problem is that appears post_title created to send the message, but I need the post_title where the cred form is located
Sorry about that,
I change the custom post type and the url change.
Now is: hidden link
But the problem isn't just in one post...is in all custom post....
The problem is that the parent title is not a custom field. Is the generic post-title as well.
Then if I make what you tell me, my changes are:
[cred_generic_field field='post_title' type='hidden' class='' urlparam='']
{
"required":0,
"validate_format":0,
"persist":1,
"generic_type":"post_title",
"default":"[wpv-post-title]"
}
[/cred_generic_field]
and in the mail configuration:
[wpv-post-field name='post_title']