Problem:
How can I update a user Profile with a Custom User Profile Image?
Solution:
The WordPress native User Profile Image is based on Gravatar, as you will know.
So you can not update that with any Image you store in WordPress as that's an external service.
You can use a Custom Image User Field instead.
1. Create a user Field (Image)
2. Create a Post Field (image)
3. Create a CRED Form to create (or update) a Post
4. Insert this code (adapt it) to your functions.php:
add_action('cred_save_data', 'my_save_data_action',10,2);
function my_save_data_action($post_id, $form_data)
{
// if a specific form
if ($form_data['id']==44)
{
$image_value = get_post_meta($post_id, 'wpcf-image', true);
$user = wp_get_current_user();
$user_id = $user->ID;
update_user_meta($user_id, 'wpcf-image-user', $image_value);
}
}
It also grabs the current User ID (which you need to address the User)
If you need another user, I suggest to study the WordPress API
or
I used
which returns the currently logged in user.