Update a user other than the currently logged in user

A project I’m working on is using Gravity Forms User Registration Add-On and we have two parent/child user roles. I used the gform_user_registration_update_user_id filter to populate the form fields with the required child account user ID. The data is coming fine but every time I submit the form it updates the logged in user which is the parent account instead of updating the one with the provided ID.

add_filter('gform_user_registration_update_user_id_5', function ( $user_id, $entry, $form, $feed ) {
    if(isset($_GET['uid'])){
        $user_id = $_GET['uid'];
    }
    return $user_id;
}, 10, 4 );

Hi Akish,

We have a snippet that allows updating other user’s info based on the email address provided, which should work for your use case. You will have to update your code snippet to populate the field with the required child account email address instead of the User ID to get the snippet working for you.

I hope this helps.

Best,

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.