Change the submitter user of an existing form

I am using Gravity Forms with wpDataTables to display entries to users who can then edit/modify the data that was submitted via Gravity Forms. wpDataTables has a means of limiting the records displayed to only the user who submitted the form. This works great… EXCEPT when that user leaves the company and they want a new user to manage the data.

Is there a way to edit the user submitted id and assign it to another user? I have searched a bit and find that GravityViews does this, but I am loathe to add yet another plugin, particularly a powerful one like GravityViews, when all I need is this one little feature.

You can definitely update the user ID associated with a Gravity Forms entry without using a plugin like GravityViews. To do this, you can create a custom code snippet to handle the update process.

Here’s a code snippet that demonstrates this process:

add_action( 'gform_after_submission', 'update_entry_user_id', 10, 2 );

function update_entry_user_id( $entry, $form ) {
    // Get the new user's email address or user ID from the submitted form data.
    $new_user_email = rgar( $entry, 'input_1' );
    // Query the database to find the user ID associated with the new user's email address or user ID.
    $new_user_id = email_exists( $new_user_email );
    // Update the entry's user ID field with the new user's user ID.
    GFAPI::update_entry_field( $entry['id'], 1, $new_user_id );
}

I hope this helps! Let me know if you have any questions or need further assistance.

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