An example would be:
Head to hidden link
You will see a volunteer offer from Rob Wilkinson at Pending Status.
If you click on FOH button (which is form 9214) It should update the Offer to Accepted and the email notifications in form 9214 are set to send 36 hours before the show date of Sun 21st Apr 2024 @ 5:00 pm
It uses code that you helped us create some time ago in the snippets plugin here: hidden link from line 156 to update the trigger date for the notification.
Relevant code:
// Set email date for volunteer reminders
// add post expiration date base on user date
// add_action( 'parent_post_id', 'parent_post_id_shortcode',10,2);
// function parent_post_id_shortcode( $atts ) {
// global $post;
// get the parent Post ID
// $parentpostid = toolset_get_related_post($post_id, 'opportunity-offer' );
// return $parentpostid;
// }
// $expdate = $parentpostid['wpcf-show-date-and-time'];
// add_post_meta($post_id, '_cred_post_expiration_time', $expdate);
// Update Offer Author with User
add_action('cred_submit_complete', 'save_data_form_4737',10,2);
function save_data_form_4737($post_id, $form_data) {
// This is the form that updates Post A
if ($form_data['id']==9194||$form_data['id']==9214||$form_data['id']==9225||$form_data['id']==9224) {
$related_post_id = toolset_get_related_post($post_id, 'show-link-to-offer','parent');
$a_expiry = get_post_meta($related_post_id, 'wpcf-show-date-and-time-be', true);
// update expiry date
update_post_meta($post_id, '_cred_post_expiration_time', $a_expiry);
}
}