Hello,
We're trying to do a similar thing as this post: https://toolset.com/forums/topic/form-data-issue/
However, we are having trouble with image fields.
This is working (mostly):
add_action('cred_save_data', 'msp_memberup',10,2);
function msp_memberup($post_id, $form_data)
{
if ($form_data['id'] == 4820)
{
$user_id = get_current_user_id();
$firstname = "first_name";
$lastname = "last_name";
$photoID = "wpcf-photo-id";
update_user_meta( $user_id, $firstname, $_POST['wpcf-first-name']);
update_user_meta( $user_id, $lastname, $_POST['wpcf-last-name']);
update_user_meta( $user_id, $photoID, $_POST['wpcf-photo-id']);
}
}
But only the image filename get's added to the wpcf-photo-id field. I believe this needs to be some sort of array. How do we modify this to pass all necessary image values from one field to the other? At the very least, we need the full path to the image, not just imagename.jpg
Please advise,
Thankyou!
You can try get the image full path from custom post field value, for example:
replace this line from:
update_user_meta( $user_id, $photoID, $_POST['wpcf-photo-id']);
To:
update_user_meta( $user_id, $photoID, get_post_meta($post_id, 'wpcf-photo-id', true));