Gravity Forms and Simple Local Avatars integration

I’m using Gravity Forms and Gravity Forms User Registration Add On to allow new users to register/join. I’m using Simple Local Avatars to allow registered users to upload a profile photo. What I would like to do is integrate the two for a seamless registration/join flow – but I’m having a lot of trouble getting the two to work together.

Here’s the frontend code I need for Simple Local Avatars:

Read More
global $user_ID;
if ($user_ID) {
    $user_info = get_userdata($user_ID);
    $id = $user_info->ID;
}

if(isset($_POST['user_avatar_edit_submit'])) { do_action('edit_user_profile_update', $id); } ?>

echo "<form id='your-profile' action='' method='post'>";
$myAv = new simple_local_avatars();
$myAv->edit_user_profile($user_info);
echo "<input type='submit' name='user_avatar_edit_submit' value='OK'/>";
echo "</form>";

It looks like the plugin saves the profile image to usermeta field: simple_local_avatar.

I think this is the filter I need for GF User Registration, but I can’t figure out how to link the two.

add_action("gform_user_registered", "add_user_photo", 10, 4);
function add_user_photo($user_id, $config, $entry, $user_pass) {
      update_user_meta($user_id, 'simple_local_avatar', $entry[1]);
}

Any ideas?

Related posts

Leave a Reply