Title: Trigger email notifications after Forminator_API::update_form_entry
Last modified: May 30, 2026

---

# Trigger email notifications after Forminator_API::update_form_entry

 *  [danidada](https://wordpress.org/support/users/danidada/)
 * (@danidada)
 * [1 week, 2 days ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/)
 * Hello,
   I’m building an integration with an external system that is almost working.
   I have the external event sending a POST request to a page where I execute Forminator_API::
   update_form_entry to set the new value for a hidden field.But here is my problem:
   I wanted to re-trigger email notifications based on the updated field of the 
   entry but can’t make it work. I’ve found your code at [https://gist.github.com/wpmudev-nebu/8156116010f009ab3a6823f74a24ecbe](https://gist.github.com/wpmudev-nebu/8156116010f009ab3a6823f74a24ecbe),
   but either the notification is not sent or the notification fields (all fields
   with {name}, not just the updated one) are all stripped.Can you tell me if my
   idea is achievable and point me in the right direction?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Support [Patrick – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport12/)
 * (@wpmudevsupport12)
 * [1 week, 2 days ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18923680)
 * Hi [@danidada](https://wordpress.org/support/users/danidada/)
 * I hope you are doing well.
 * You will need to use the Forminator_CForm_Front_Mail() class and then the process_mail()
   function.
 * But note that custom coding is outside our support scope, for that, you’ll need
   to hire a developer to provide the required custom code for you. WordPress provides
   a jobs directory here [https://jobs.wordpress.net/](https://jobs.wordpress.net/),
   if you need further advice about it, feel free to email `wpsupport@incsub.com`.
 * Subject: ATTN: WPMU DEV support – wp.org
 * Best Regards
    Patrick Freitas
 *  Thread Starter [danidada](https://wordpress.org/support/users/danidada/)
 * (@danidada)
 * [1 week, 2 days ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18923692)
 * Hello Patrick,
 * I am using the class and function you mentioned but the data sent in the notification
   is the “old” data, not the updated entry data. I have used the same code as in
   the plugin.
 *     ```wp-block-code
                           // this one is the code updating the field value Forminator_API::update_form_entry( $form_id, $entry_id, array( array('name'=>'hidden-3', 'value'=>"si") ) );                    $error = '';                    if ( isset( $entry_id ) ) {                        $forminator_mail_sender = new Forminator_CForm_Front_Mail();                        $entry                  = new Forminator_Form_Entry_Model( $entry_id );                        if ( empty( $entry->form_id ) || ! empty( $entry->draft_id ) ) {                            $error = esc_html__( 'Entry ID was not found.', 'forminator' );                        }                        $module_id = $entry->form_id;                        Forminator_Front_Action::$module_id     = $module_id;                        Forminator_Front_Action::$module_object = Forminator_Base_Form_Model::get_model( $module_id );                        // Emulate Forminator_Front_Action::$prepared_data.                        Forminator_Front_Action::$prepared_data = recreate_prepared_data( Forminator_Front_Action::$module_object, $entry );                        // Emulate Forminator_Front_Action::$hidden_fields.                        if ( ! Forminator_Front_Action::$module_object ) {                            $error = esc_html__( 'Error: Module object is corrupted!', 'forminator' ) ;                        }                        Forminator_Front_Action::$module_settings = method_exists( Forminator_Front_Action::$module_object, 'get_form_settings' )                        ? Forminator_Front_Action::$module_object->get_form_settings() : Forminator_Front_Action::$module_object->settings;                        Forminator_CForm_Front_Action::check_fields_visibility();                        $module_object = Forminator_Base_Form_Model::get_model( $module_id );// printed data is the updated one                        var_dump($entry);//data sent by mail is the old one                        $forminator_mail_sender->process_mail( $module_object, $entry );
       ```
   
 *  Thread Starter [danidada](https://wordpress.org/support/users/danidada/)
 * (@danidada)
 * [1 week, 2 days ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18923711)
 * Just to get you an update on the code I’m testing. Now it reflects new value 
   on email notification content BUT it doesn’t fire if there is a condition based
   on the updated field value.
 *     ```wp-block-code
       //the updateForminator_API::update_form_entry( $form_id, $entry_id, array( array('name'=>'hidden-3', 'value'=>"si") ) );                    $error = '';                    if ( isset( $entry_id ) ) {                        $get_data_from_entry = $this->data_from_enty($entry);                        $submitted_data = Forminator_Core::sanitize_array( $get_data_from_entry );                        // Send email.                        $custom_form = Forminator_Form_Model::model()->load( $form_id );                        if ( ! is_object( $custom_form ) ) {                            $error .= json_encode(                                array(                                    'message' => apply_filters(                                        'forminator_draft_invalid_form_id',                                        esc_html__( 'Invalid form ID.', 'forminator' ),                                        $form_id                                    ),                                )                            );                        }                        $forminator_mail_sender       = new Forminator_CForm_Front_Mail();                        $draft_entry                  = new Forminator_Form_Entry_Model( $entry_id );                        // just to check var_dump($draft_entry);                        Forminator_Front_Action::$prepared_data = array_replace( Forminator_Front_Action::$prepared_data, $submitted_data );                        $mail_sent                    = $forminator_mail_sender->process_mail( $custom_form, $draft_entry );                    }
       ```
   
 * Can you please tell me what I am missing? Just ANY condition stop the notification
   from being sent, also for fields that wasn’t updated.
    -  This reply was modified 1 week, 2 days ago by [danidada](https://wordpress.org/support/users/danidada/).
    -  This reply was modified 1 week, 2 days ago by [danidada](https://wordpress.org/support/users/danidada/).
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [1 week, 1 day ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18924334)
 * Hello [@danidada](https://wordpress.org/support/users/danidada/)
 * I asked our developers to see if you need to use a different hook or method to
   make this work.
 * We will get back to you when having more updates.
 * Best Regards,
    Amin
 *  Plugin Support [Amin – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support2/)
 * (@wpmudev-support2)
 * [6 days, 4 hours ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18926159)
 * Hello [@danidada](https://wordpress.org/support/users/danidada/)
 * We have further feedback from our developers.
 * **Forminator_API::update_form_entry()** only updates the entry meta in the database.
   It does not automatically re-trigger notifications or rebuild the submission 
   context that conditional notifications use.
 * After calling the update_form_entry() function, it is important to follow the
   same pattern as Forminator’s resend-notification process. If only the modified
   field is injected using array_replace(), the notification conditions will not
   have the complete context of the submission. As a result, these conditions may
   evaluate to false, and the email notification could be skipped.
 * I’m afraid since custom coding is out of scope of our support we can’t you further
   you need to hire a developer or review the plugin codes, as my colleague mentioned
   [here](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18923680).
 * Best Regards
    Amin
 *  Thread Starter [danidada](https://wordpress.org/support/users/danidada/)
 * (@danidada)
 * [5 days ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18927589)
 * Hello, thanks for your reply Amin and sorry for my delay.
   I understand your mention
   about the custom coding being out of scope, but let me just correct one thing
   in your reply: you wrote “If only the modified field is injected using array_replace(),
   the notification conditions will not have the complete context of the submission”
   but in here
 *     ```wp-block-code
       Forminator_Front_Action::$prepared_data = array_replace( Forminator_Front_Action::$prepared_data, $submitted_data );
       ```
   
 * $submitted_data is extracted from the entry
 *     ```wp-block-code
       private function data_from_enty( $entry ) {        	$post_data = array();        	foreach ( $entry->meta_data as $key => $meta ) {        		if ( ! isset( $meta['value'] ) ) {        			continue;        		}        		$post_data[ $key ] = $meta['value'];        	}        	return $post_data;        }
       ```
   
 * so it contains all data, not only the edited one.
 * The only way I’ve found to workaround the problem is to manually remove the conditions
   in the notifications ( in $custom_form->notifications before passing it as the
   first parameter of $forminator_mail_sender->process_mail ) but I don’t really
   like it (although it works) so if I need to pass the context as you said with
   another call like you wrote, could you enlighten me? Because I didn’t find any
   of it in the code.
 * Thanks again
 *  Plugin Support [Jair – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport15/)
 * (@wpmudevsupport15)
 * [4 days, 13 hours ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18928073)
 * Hello [@danidada](https://wordpress.org/support/users/danidada/)
 * I’m afraid that at this moment, there is currently no single public API method
   that both updates the entry and re-runs conditional notifications automatically.
   The only way to do it is through custom code, similar to what are you doing it.
 * Kind regards,
   Jair.

Viewing 7 replies - 1 through 7 (of 7 total)

You must be [logged in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Ftrigger-email-notifications-after-forminator_apiupdate_form_entry%2F%3Foutput_format%3Dmd&locale=en_US)
to reply to this topic.

 * ![](https://ps.w.org/forminator/assets/icon-256x256.gif?rev=3443182)
 * [Forminator Forms – Contact Form, Payment Form & Custom Form Builder](https://wordpress.org/plugins/forminator/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/forminator/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/forminator/)
 * [Active Topics](https://wordpress.org/support/plugin/forminator/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/forminator/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/forminator/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [Jair – WPMU DEV Support](https://wordpress.org/support/users/wpmudevsupport15/)
 * Last activity: [4 days, 13 hours ago](https://wordpress.org/support/topic/trigger-email-notifications-after-forminator_apiupdate_form_entry/#post-18928073)
 * Status: not resolved