Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

frm_after_update_entry

This hook allows you to do something with the data entered in a form after it is updated.

Usage

add_action('frm_after_update_entry', 'after_entry_updated', 10, 2);
function after_entry_updated($entry_id, $form_id)

Parameters

  • $entry_id (integer)
  • $form_id (integer)

Examples

Automatically update a field in another form

Use this code to update a field in Form B when a field is updated in Form A. This code will update all entries in Form B where the userID is the same as Form A. For example, when a user updates their Email address in an "Edit Profile" form, then the email address stored in all of that user's entries in a second form will be automatically updated to match the new email address.

add_action('frm_after_create_entry', 'frm_update_field_after_update', 30, 2);
add_action('frm_after_update_entry', 'frm_update_field_after_update', 10, 2);
function frm_update_field_after_update( $entry_id, $form_id ) {
	if ( $form_id == 19 ) {//Change 19 to the ID of Form A
		$args = array( 'links' => false, 'truncate' => false );

		// Change 363 to the ID of the field that will be updated manually
		$updated_field = FrmField::getOne( 363 );
		$new_field_value = FrmProEntryMetaHelper::get_post_or_meta_value( $entry_id, $updated_field, $args );

		// Change 370 to the ID of the userID field in Form A
		$user_id_field_a = FrmField::getOne( 370 );
		$user_id_value = FrmProEntryMetaHelper::get_post_or_meta_value( $entry_id, $user_id_field_a, $args );

		// Change 452 to the ID of the userID field in Form B
		$user_id_field_b = FrmField::getOne( 452 );
		$entry_ids_to_update = FrmProEntryMeta::get_entry_ids_for_field_and_value( $user_id_field_b, $user_id_value );

		// Change 488 to the ID of the field to update (in Form B)
		$field_id_to_update = 488;

		foreach ( $entry_ids_to_update as $e ) {
			FrmEntryMeta::update_entry_meta( $e, $field_id_to_update, '', $new_field_value );
		}
	}
}

Change a user's role

Change a user's role with a dropdown or radio field. Replace 41 with the ID of your form, replace 1775 with the ID of the userID field in the form, and replace 1134 with the ID of the role dropdown or radio field.

add_action('frm_after_update_entry', 'update_user_role', 10, 2);
function update_user_role($entry_id, $form_id){
    if ( $form_id == 41 ) {
        
        $userid = $_POST['item_meta'][1775];// 1775 is the ID of the userID field
        $role = $_POST['item_meta'][1134];// 1134 is the ID of the role dropdown
            
        if ( $userid && $role ) {
            $user = get_userdata( $userid );
            if ( $user && ! $user->has_cap('administrator') ) {
                $user->set_role( $role );
            }
        }
    }
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms