I tried using acf/save_post
like this:
function detect_acf_changes_and_register_zoho_form($post_id)
{
// Ensure the form is from ACF
if (isset($_POST['acf'])) {
// Retrieve data from the ACF field, for example, from the 'register_section' group
$register_section = get_field('register_section', $post_id);
if ($register_section) {
// Retrieve the subfield 'register_form' from the group or repeater
$zoho_form_data = $register_section['register_form'];
// Ensure the form data is not empty
if ($zoho_form_data) {
// Function to save or register Zoho Form
register_zoho_form_data($zoho_form_data);
// Award points to the user with the correct point slug
$current_user_id = get_current_user_id();
if ($current_user_id) {
// Replace 'event_registration_points' with the appropriate point slug
gamipress_award_points_to_user($current_user_id, 150, 'my_slug_point');
error_log("Points awarded to user ID: " . $current_user_id);
} else {
error_log("No user is logged in.");
}
}
}
}
}
add_action('acf/save_post', 'detect_acf_changes_and_register_zoho_form', 20);
But it still doesn’t work, and I also tried using Automatic Point Update, but when I select the post I created in ACF and update it, the selection goes back to empty again.