Skip Navigation

[Resolved] Toolset contact form listing with custom title in backend

This support ticket is created 5 years, 3 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by DieterR7285 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1359305
Toolset-contact-form-listing.png

Tell us what you are trying to do?
I want to display the ID of the submitted form, the name as well as the subject of the submit field content of the custom Toolset contact form I created.
I managed to get the ID to show in the list of submitted contact forms in the back-end using a custom script to be used in the functions.php I found in one of the support replies. But could not make it work for the submit text to be shown:
// Toolset contact form
add_action('cred_save_data','contact_title', 10, 2);
function contact_title($post_id, $form_data) {
// if a specific form
if (($form_data['id']==790)) {
$type = get_post_type($post_id, $form_data);
if ($type == 'contact-form')
{
$subject = get_post_meta($post_id, 'subject-contact', true);
$key = $post_id . ' - ' . $subject;
$slug = sanitize_title($key);
wp_update_post(array('ID' => $post_id, 'post_title' => $key, 'post_name' => $slug));
}
}
}

Is there any documentation that you are following?
I could not find one.

What is the link to your site?
hidden link or hidden link

#1359353

Hello,

How do you setup the custom field "subject-contact"?
If it is created with Types plugin, Types plugin will pre-pend string "wpcf-" before field slug, so in database, the real field slug is:
wpcf-subject-contact

You can try to replace this line of your PHP codes from:

$subject = get_post_meta($post_id, 'subject-contact', true);

To:

$subject = get_post_meta($post_id, 'wpcf-subject-contact', true);

And test again.

#1360065

My issue is resolved now. Thank you!