Related to the code, I refactored this below, please see the comments
add_action('cred_save_data','mm_create_title_and_slug',10,2);
function mm_create_title_and_slug($post_id, $form_data) {
if ( ($form_data['id']==1509) | ($form_data['id']==1560)) {
//no need to get_post, the current post ID is already in $post_id delivered by Forms, see DOC and you never seem to use the object
//$post = get_post( $post_id );
$date = get_post_meta($post_id, 'wpcf-event-date', true);//OK, this gives you a numeric timestampt
$winner = get_post_meta($post_id, 'wpcf-winner', true);//OK, not sure what the field is, but it will be a single value too
//The strtotime() function is a built-in function in PHP which is used to convert an English textual date-time description to a UNIX timestamp. But, you already have a Toolse Types Date field and that is a Timetstamp, not an english text date. So, you do not need this, it is already a timstampt. If you want to convert timestamp to human, use date() instead.
//$new_date = strtotime($date);
$relationship = 'venue-event';//OK, if this is your relationship slug
//Retrieve an ID of a single related post. This will only work to get ONE related post. Is this the goal? Then it's fine.
//Please error_log(print_r($related_post_id, true)); so you know what you get here.
$related_post_id = toolset_get_related_post($post_id, $relationship, 'parent' );
$venue_title = get_the_title( $related_post_id );//OK, we get the other posts title - as said above, make sure, $related_post_id is what you expect
$title= $date. ' at ' . $venue_title;//this will now create a string like 328947529387459atTITLE. This because we have a timstamp, that is not converted to human readable format and it concatenates to at and the related post title.
$slug = sanitize_title($title);//OK, if you want to sanitize
$args = array('ID' => $post_id, 'post_title' => $title, 'post_name'=>$slug);
wp_update_post($args); //here we update the current post with all tha combined.
}
}
Note, if this does not work, try to hook the entire code to cred_submit_complete
This because the relationship is set late, so it's better to hook in when all operations are done.
----------------------------------------------------------------------------------------------------------------------------------------------------------------
There might be something else that is of interest for you:
The only (now deprecated) official way to display a Parent Post on a Child Form was when not using Many To Many but One To Many or One to One relationships, and it will be possible to display only on the "one" end of the Relationship on the "Many" end.
The ShortCodes are deprecated and not documented but should still work:
[cred-post-parent get='title'] and [cred-post-parent get='url']
Field of parent posts can never be called, and it is generally tricky to call parent data, as long that parent is not connected yet, we do not know the parent
Often, a trick is to read the URL attribute that the "Create child Post Form" creates when you click on a "create child post link"
That allows setting the Post ID of any Shortcode that allows an item attribute.
So for example, you can display the post title using [wpv-post-title] and if you add param ="[wpv-search-term term="parent_page_id"]"
[wpv-post-title item="[wpv-search-term param='parent_page_id']"]
Above can be inserted in any Form that creates Child Posts for a Parent and will appear on a page that has a URL parameter of parent_page_id appended.
And that happens always when you insert the Link to that Child Post Form like so in a parent post:
[cred_child_link_form form='34' parent_id='-1' text='Create new' target='_self']
Doing so creates a link that links to the page where you insert the "create child form". It takes the ID of the current parent post and passes it to that other page in the URL parameter parent_page_id. This then helps us display anything from the parent post type, inclusive fields, or even queried Views.
I hope this helps, it should avoid some custom code, I think