I am using PODS to add info to a users profile. I want to add data to the usermeta then do something with it right away. One the fields created by PODS is 'estimated_delivery_date'. I have simplified the code as show below.
add_action( 'profile_update', 'initiate_participant_profile_update', 10, 2 );
function initiate_participant_profile_update( $user_id, $old_user_data ) {
$estDD = get_user_meta( $user_id, 'estimated_delivery_date', true );
$pathBodyFile = dirname(__FILE__) . "/$user_id" . "ParticipantData.txt";
$fileBody = fopen($pathBodyFile, "a");
echo fwrite($fileBody, "Estimated Delivery Date: $estDD\n\n");
fclose($fileBody);
}
When I add the info using the Update User profile page $estDD does not appear in the file. But if I go back to the edit profile page and hit Update User again, boom, there it is.
So I am surmising the the action is running before the usermeta is updated. How can I fix this?