I have one question for the other system that can be more easily asked here.
For this system, I wanted the registration title to be: Ride Name Registration - Registrant Name - Date
You used this code for that.
add_action('cred_save_data', function($post_id, $form_data) {
if ($form_data['id']==2083) { // speccific post form ID
$name = get_post_meta($post_id, 'wpcf-name', true);
$email = get_post_meta($post_id, 'wpcf-email', true);
$date = get_the_date('m/d/Y', $post_id);
$parent_ride_id = toolset_get_related_post($post_id, 'ride-registration', 'parent');
$parent_ride_title = get_the_title($parent_ride_id);
$post_title = sprintf('[%1$s] Registration - [%2$s] [%3$s]', $parent_ride_title, $name, $date);
$slug = sanitize_title($post_title);
wp_update_post(array(
'ID'=>$post_id,
'post_title'=>$post_title,
'post_name' => $slug
));
}
},10, 3);
For the new system using this same approach, we want the Vote title to only be:
Freelancer Name - Voting Board Member Name
with no date added. We don't have an e-mail address field on the voting form, so I deleted that from your code.
I've gotten this partially there with the following code:
add_action('cred_save_data', function($post_id, $form_data) {
if ($form_data['id']==7956) { // speccific post form ID
$name = get_post_meta($post_id, 'wpcf-name', true);
$parent_freelancer_id = toolset_get_related_post($post_id, 'freelancer', 'parent');
$parent_freelancer_title = get_the_title($parent_freelancer_id);
$post_title = sprintf('[%1$s] Board Vote - ', $parent_freelancer_title, $name);
$slug = sanitize_title($post_title);
wp_update_post(array(
'ID'=>$post_id,
'post_title'=>$post_title,
'post_name' => $slug
));
}
},10, 3);
But I'm not sure how to code this to pull the Voting Board Member Name . This data should pull the username of the author of the Vote post form submission which should be placed immediately after the bit that says Board Vote - . I'm not skilled at PHP and can only do minor edits like I've tried to do here with some success. Other than this, I believe I have this step on our next system completed. I'll post subsequent questions about that with that user account, but this one seemed more easily doable here and made more sense to keep it together with this one since we already were using this bit of code. Thanks again if you can get me past this hurdle. I've done pretty well setting this up myself using your same approach. I'm glad it looks like my only remaining question to emulate this will be what I think/hope will be a pretty simple code tweak for you to show me how to pull the post author username.