Sorry to open a new ticket but I have not heard anything regarding https://toolset.com/forums/topic/user-and-post-forms-not-working-after-upgrading-to-php-8-1/ . Can someone get back to me please
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
Luo is on vacation and this is Minesh here and I'll take care of this ticket. Hope this is OK.
As Luo shared with his previous reply that there is a critical error once you submit the form:
- https://toolset.com/forums/topic/user-and-post-forms-not-working-after-upgrading-to-php-8-1/#post-2491093
I see the fatal error when there is no input added to your fields assessment criteria 1 to 6.
I'm able to reproduce the same error while I try to submit the form. I see the following code is added to your theme's functions.php file using the save_post hook:
function calculate_fields( $post_ID ) {
if ( get_post_type( $post_ID ) == 'application1' ) {
$score1 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-1',true);
$score2 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-2',true);
$score3 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-3',true);
$score4 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-4',true);
$score5 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-5',true);
$score6 = get_post_meta($post_ID, 'wpcf-assessment-criteria-score-6',true);
if($score1== '') $score1 = 0;
if($score2== '') $score2 = 0;
if($score3== '') $score3 = 0;
if($score4== '') $score4 = 0;
if($score5== '') $score5 = 0;
if($score6== '') $score6 = 0;
$totalscore = $score1 + $score2 + $score3 + $score4 + $score5 + $score6;
update_post_meta( $post_ID, 'wpcf-cja-longlist-score', $totalscore );
}
}
add_action( 'save_post', 'calculate_fields', 99 );
Can you please try the above code and check if that help you to resolve your issue.
My issue is resolved now. Thank you!