Can you please share live site access details and setup a test page where you added your form, maybe you would like to create another form so we can test it.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
add_action('cred_save_data', 'func_set_custom_post_expiration_date_time',10,2);
function func_set_custom_post_expiration_date_time($post_id, $form_data){
// if a specific form
if ($form_data['id']==4896){
Thank you after several tests I was able to get this to work now. The correct code should be.
add_action('cred_save_data', 'func_set_custom_post_expiration_date_time',10,2);
function func_set_custom_post_expiration_date_time($post_id, $form_data){
// if a specific form
if ($form_data['id']==4896){
$expiry_date = $_POST['expiration-date']["datepicker"];
update_post_meta($post_id, '_cred_post_expiration_time', $expiry_date );
}
}
The problem was that you were selecting the wrong identifier for the expiration-date field which caused the custom field for the expiration date not to get update.
On further checks I noticed that it was still not working.
This lead me to believe that the value of the expiration is being set much later by Toolset forms than the point where the hook is setting the date. This means that our date is being overwritten by the default information.
Now I used a hook that fires later than the cred_save_data hook and this works. I've tested it and the date value is now being set correctly.
add_action('cred_submit_complete', 'func_set_custom_post_expiration_date_time',10,2);
function func_set_custom_post_expiration_date_time($post_id, $form_data){
// if a specific form
if ($form_data['id']==4896){
$expiry_date = $_POST['expiration-date']["datepicker"];
update_post_meta($post_id, '_cred_post_expiration_time', $expiry_date );
}
}
PLease go ahead and test this and let me know if the date is being set for you as well.