Skip Navigation

[Escalated to 2nd Tier] Cannot remove image from user profile with edit form

This support ticket is created 2 years, 9 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 – 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 3 replies, has 2 voices.

Last updated by Luo Yang 2 years, 9 months ago.

Assisted by: Luo Yang.

Author
Posts
#2296849

I am unable to remove the image from CRED edit user form after the image has been uploaded. I can replace that image with another image but can't remove it completely.

Here is a video - hidden link

What am I missing?

#2298429

Hello,

Thanks for the feedback, I can duplicate the same problem, and have escalated this issue, will update here if there is anything news.

Currently, you can use action hook "cred_save_data" to remove the custom image field value, for example, add below codes into your theme file "functions.php":

add_action('cred_save_data', function($user_id, $form_data){
	if ($form_data['id']== 123) // replace 123 with your user form's ID
    {
		$image_field_slug = 'wpcf-' . 'test-image-1'; // replace test-image-1 with your image field slug
        if (!isset($_POST[$image_field_slug]))
        {
            // delete post meta
            delete_user_meta($user_id, $image_field_slug);
        }
    }
}, 99, 2);

More help:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data

#2299213

Thanks. The workaround works.

#2299469

I have marked this thread as "Escalated" status, will update here if there is anything news.