Skip Navigation

[Resolved] update_user_meta – Image Fields

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 9 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by caseyJ 9 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#273973

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!

#274006

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)); 
#274739

That works!
Thanks Luoy!

The forum ‘Types Community Support’ is closed to new topics and replies.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.