• Resolved matlino

    (@matlino)


    I would like to access the entry ID value inside the email notification. The same way I can access field values. Is it possible?

    I know I can inject entry ID into email myself using ‘forminator_replace_custom_form_data’ hook. But I am passing entry ID into my custom shortcode which I use to generate email content. So I need to use it like this:
    [my_shortcode entry_id={entry-id}]

    It would be great if I could access the entry ID value this way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @matlino

    I hope you are doing well.

    Please, let me know if I’m missing anything

    Are you receiving the ID on your custom function?

    function my_function($entry_id){ ... }

    Not sure how the code is created, but you can use the forminator_custom_form_submit_before_set_fields which receive the $entry

    add_action( 'forminator_custom_form_submit_before_set_fields', function($entry, $form_id, $field_data_array){
    
    $id = $entry->entry_id;
    
    //Do something..
    
    },10,3);
    /**
    * Action called before setting fields to database
    *
    * @since 1.0.2
    *
    * @param Forminator_Form_Entry_Model $entry - the entry model
    * @param int $form_id - the form id
    * @param array $field_data_array - the entry data
    *
    */
    do_action( 'forminator_custom_form_submit_before_set_fields', $entry, $form_id, $field_data_array );

    Let us know if I’m missing anything here,

    Best Regards
    Patrick Freitas

    Thread Starter matlino

    (@matlino)

    Exactly I needed the entry_id in my custom function which is executed when my custom shortcode is used which I place inside the body of forminator email notification. And inside this function, I need the entry_id because I am using it in URL which I send in the email. So this is the use case where the entry_id is needed to have in email notification UI.

    For anyone else, the workaround is the hook ‘forminator_replace_custom_form_data’ which be used to edit the email content manually.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Access Entry ID value in email notification.’ is closed to new replies.