Skip Navigation

[Resolved] Registration form has an image field, and i need save the url of this image

This support ticket is created 7 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 7 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#411031

I am trying to:

Save url of image upload with image field in CRED user registration form.

In the Registration Form, I have image field and url image field. When I save the Form I need to get the url of the image and put it on the url field.

How can I do?

#411121

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Thank you for contacting our support forum.

You can actually do this with a hook from CRED to copy the information in the POST request to the other custom field.

add_action('cred_save_data', 'copy_url',10,2);
function copy_url($post_id, $form_data)
{
    // if a specific form
    if ($form_data['id']==1360)
    {

    	$url = $_POST['wpcf-my-image'];
        update_post_meta($post_id, 'wpcf-my-url-field', $url);        
    }
}

Add the above to your functions.php, replace wpcf-my-image with the name of your image custom field keeping the wpcf- prefix, same for the my-url-field. Also you need to change the 1360 to the id of your form.

Please let me know if this helps.

Thanks,
Shane

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