Problem: I have two custom fields in a post type. When a Form is submitted to create posts, I would like to automatically populate one of the custom fields using information from the other custom field to generate an HTML link tag.
Solution: Use the cred_save_data hook to trigger your own custom code when a Form is submitted.
add_action('cred_save_data', 'tssupp_autopopulate_html',10,2);
function tssupp_autopopulate_html($post_id, $form_data)
{
$forms = array( 123, 456 );
$input_slug = 'your-input-field-slug';
$destination_slug = 'your-destination-field-slug';
// if this hook is fired when submitting any of the forms in $forms
if ( in_array( $form_data['id'], $forms ) )
{
// if input field has content, build the HTML string and save it in destination field
if (isset($_POST['wpcf-' . $input_slug]))
{
$input = $_POST['wpcf-' . $input_slug];
$content = '<a href="' . $input . '">' . $input . '</a>';
update_post_meta($post_id, 'wpcf-' . $destination_slug, $content);
}
}
}
Problem: I would like to create multiple Content Templates using an existing Content Template as the starting point so I don't have to recreate the design over and over.
Solution: Use the Duplicate feature in the Content Templates list to create a clone of an existing template. Hover over the CT title to see the Duplicate link.
Solution:
No.
"cred_save_data" hook belongs to Toolset forms and it will only triggered when you submit the form that is created using Toolset.
If you are using another plugins using which you created user form, you should check with that plugin support if they offer any hook that you should use to hook your custom code.