Hi we have a CPT for Inquires, the form has 'Name' field, when we checked the entries in the admin panel, the entries were showing code - CRED Auto Draft 1c2135d0d330a934f14b3fd307dd49ba hidden link
Which I presume is because we are not using the title field in the form, so we replaced the 'Name' field with the title field, then the email notification label displays 'Space form entry Title' hidden link
Is there a way round this? to either edit the notification label of the title or to keep the name field but show this in the entries list of the admin panel?
Hi Leila,
Thank you for contacting us and I'd be happy to assist.
When the post title field is not included in the Form and you'd like to generate that title from the value of another field (e.g. 'Name' field in your case), you can use the "cred_submit_complete" hook:
( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_submit_complete )
Example:
add_action('cred_submit_complete', 'my_success_action',10,2);
function my_success_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==123)
{
$my_post = array(
'ID' => $post_id,
'post_title' => $_POST["wpcf-name"],
'post_name' => $_POST["wpcf-name"]
);
// Update the post into the database
wp_update_post( $my_post );
}
}
Note: you'll replace 123 with the actual ID of your form and "name" with the actual slug of your "Name" field.
The above code snippet can be included through either Toolset's custom code feature ( ref: https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/ ) or through active theme's "functions.php" file.
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
Exactly what we needed! Thanks for your help 🙂