• Resolved lieuwe1957

    (@lieuwe1957)


    Forminator starts with #1 for every new forms, great.
    but….the forms tab shows different numbers, based on the total set of froms used.
    so, my new xxxx form with submissions_number 4 is not directly visible: it has now submission_id 55.
    doesn’t make life easy to find the rigth form back.
    please help

    regards
    Lieuwe

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

    (@wpmudevsupport12)

    Hi @lieuwe1957

    I hope you are doing well.

    I am afraid it is expected, the IDs are shared across the forms, so for example:

    Form A has 3 submissions, Submission 1 2 3
    Form B has one submission after 3 of Form A, the submission ID will be 4.

    We do have plans to improve this behaviour but unfortunately, we can’t give an estimated time.

    Best Regards
    Patrick Freitas

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Patrick,
    thx for responding.
    Is there an other way to “connect”?
    my website has a page with a from with a questionnaire (anonymus) and after submitting, another new page shows the outcome. that page has also a contact form, so people who have further interest, can send a message. the questionnaire is used maybe a 100 times, before I have a message from someone with more interest. Combining that email with the questionnaire is key.
    looks like only the ip-adress can connect both.
    do you have an alternative?
    thx in advance
    leo

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @lieuwe1957,

    I believe you are using the “Redirect user to a URL” submission behavior to redirect the users to a new page after submitting the questionnaire. If this is the case, the following code should help with adding the entry ID of the questionnaire to the redirect URL.

    https://gist.github.com/wpmudev-sls/619d8140953daac80094abadad0ef66f

    You can fetch that to a hidden field in the contact form on the redirect page. I hope that serves your purpose.

    Is there an other way to “connect”?

    I am afraid, the support for the free plugins is limited to the WordPress support forum.

    Kind Regards,
    Nebu John

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Nebu,

    thx.
    added the snippet and it doesn’t work as it should.
    added to the url: ?sub_number={submission_id}
    added a hidden field in the form on the second page with query parameter sub-number, but it returns “submission_id”.
    adding in the same form a hidden form with custom value { submission_id} givesthe submission id of the second form, not the first one.

    regards

    Lieuwe

    ps: with connect I didn’t mean a different way of offering support, but just how to connect the two forms other than with the ip-adress

    Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @lieuwe1957

    I checked the shared code and it requires some updates.

    First remove the:

    defined('FORMINATOR_PRO') &&

    https://monosnap.com/file/Nn9nHxDSgoNcZzhaOKGN2jezOtyYw1

    It will look like this:

    https://monosnap.com/file/SShXqfAsykNZEJtywyiGQx3aTyQdnW

    Update line 16 using your form ID:

    https://monosnap.com/file/tdbrs0UGhGgF36BIbqd5lBep7TtbC3

    In the redirect URL use the same URL that you used in line 17

    https://monosnap.com/file/SvJYqcXJpuNjipCRTYICGdfkIsxHkS

    I tested using the latest version of the plugin and worked fine after the shared steps.

    Let us know the result you got.
    Best Regards
    Patrick Freitas

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Patrick,

    thx.

    I’ve made the changes exactly as given.
    does not work
    btw: the file I’ve downloaded by using the “download zip” gave a different file than visible on the page, and your screershots are also not similar to the code on the page (https://gist.github.com/wpmudev-sls/619d8140953daac80094abadad0ef66f)
    my redirect url (https://www.lieuwemontsma.nl/Disrupt/test/?score={calculation-14}&sub_number={submission_id}&ipa_dres={hidden-1}) is exactly same as in the snippet.
    Is there a specific folder where I shoudl add the snippet? now stored in folder “forminator” and also “addons”
    regards

    Lieuwe

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @lieuwe1957,

    Can you please share the updated code from your end so that we can take a closer look at this?

    Also please note, you need to add the code as a mu-plugin, that is inside the following directory:

    /wp-content/mu-plugins/

    If the directory is not present, you need to create one. Please find more on how to add a mu-plugin here: https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Kind Regards,
    Nebu John

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Nebu,
    the code:

    <?php
    /**
     * Plugin Name: [Forminator] - Add entry id to redirect url
     * Description: [Forminator] - Add entry id to redirect url
     * Author: Thobk @ WPMUDEV
     * Author URI: https://premium.wpmudev.org
     * License: GPLv2 or later
     */
    if ( ! defined( 'ABSPATH' ) ) { exit; } elseif ( defined( 'WP_CLI' ) && WP_CLI ) { return; }
    
    add_action( 'plugins_loaded', 'wpmudev_forminator_add_entry_id_to_redirect_url_func', 100 );
    
    function wpmudev_forminator_add_entry_id_to_redirect_url_func() {
    	if (class_exists( 'Forminator' ) ) {
    		class WPMUDEV_Forminator_Add_Entry_ID_To_Redirect_URL{
    			private $form_id = 175;//enter form_id here
    			private $redirect_url = 'https://www.lieuwemontsma.nl/Disrupt/test/?score={calculation-14}&sub_number={submission_id}&ipa_dres={hidden-1}';//enter your redirect url here, it must be matches with the link you added on the form
    			private $entry_id;
    
    			public function __construct(){
    				add_action( 'forminator_custom_form_submit_before_set_fields', array( $this, 'retrive_entry_id' ), 10, 2 );
    				add_filter( 'forminator_replace_form_data', array( $this, 'add_entry_id_to_redirect_url') );
    			}
    
    			public function retrive_entry_id( $entry, $form_id ){
    				if( $this->form_id == $form_id ){
    					$this->entry_id = $entry->entry_id;
    				}
    			}
    
    			public function add_entry_id_to_redirect_url( $content ){
    				if( $this->entry_id && $this->redirect_url === $content ){
    					$content = add_query_arg('entry_id', $this->entry_id, $content);
    				}
    				return $content;
    			}
    
    		}
    
    		$run = new WPMUDEV_Forminator_Add_Entry_ID_To_Redirect_URL;
    	}
    }
    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @lieuwe1957

    Thanks for response!

    The code is fine but the “redirect URL” needs a small adjustment and I’m sorry for not being clear before.

    1. In the redirecting form edit the redirect URL and remove this entire part: ?score={calculation-14}&sub_number={submission_id}&ipa_dres={hidden-1}

    2. Then, do the same in the code

    At this point both URL – in form settings and in code – should still be identical and contain no additional parameters other than just an URL of the target page

    3. edit the hidden field on the target URL and
    – make sure that “Default Value (optional)” is set to “Query Parameter”
    – and put this in “Query Parameter” field:

    entry_id

    This is because the cause adds “fixed” parameter named “entry_id” to pass over submission ID and also additional parameters included in the URL will break it. If you need additional form data from source form to be passed over to target form, it would have to be done via this code too. I would need the exact names of the fields that would have to be passed then and the names of URL parameters (query vars) that you wish to use.

    Best regards,
    Adam

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Adam.
    thx!
    all makes sense.

    next to the entry id, I need the score: score={calculation-14}
    the other two will be replaced by the entry_id

    regards

    Lieuwe

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Adam,

    do you need more information for the score to pass in the URL?
    regards

    Lieuwe

    Plugin Support Adam – WPMU DEV Support

    (@wpmudev-support8)

    Hi @lieuwe1957

    Thanks for response and sorry for the delay!

    I’ve actually modified the original code a bit so it would be easier to use and you could include any additional query vars (URL parameters) right in the plugin settings.

    You’ll want to replace the previous code with this one (it’s similar but slightly different):

    <?php
    /**
     * Plugin Name: [Forminator] - Add entry id to redirect url
     * Description: [Forminator] - Add entry id to redirect url
     * Author: Thobk & Adam @ WPMUDEV
     * Author URI: https://premium.wpmudev.org
     * License: GPLv2 or later
     */
    if ( ! defined( 'ABSPATH' ) ) { exit; } elseif ( defined( 'WP_CLI' ) && WP_CLI ) { return; }
    
    add_action( 'plugins_loaded', 'wpmudev_forminator_add_entry_id_to_redirect_url_func', 100 );
    
    function wpmudev_forminator_add_entry_id_to_redirect_url_func() {
    	if (class_exists( 'Forminator' ) ) {
    		class WPMUDEV_Forminator_Add_Entry_ID_To_Redirect_URL{
    			private $form_id = 1155;//enter form_id here
    			private $entry_id;
    			private $modify_redirect;
    
    			public function __construct(){
    				add_action( 'forminator_custom_form_submit_before_set_fields', array( $this, 'retrive_entry_id' ), 10, 2 );
    				add_filter( 'forminator_replace_form_data', array( $this, 'add_entry_id_to_redirect_url') );
    			}
    
    			public function retrive_entry_id( $entry, $form_id ){
    				if( $this->form_id == $form_id ){
    					$this->entry_id = $entry->entry_id;
    					$this->modify_redirect = true;
    				}
    				else {
    					$this->modify_redirect = false;
    				}
    			}
    
    			public function add_entry_id_to_redirect_url( $content ){
    				if( $this->entry_id && $this->modify_redirect ) {
    					$content = add_query_arg('entry_id', $this->entry_id, $content);
    				}
    				return $content;
    			}
    
    		}
    
    		$run = new WPMUDEV_Forminator_Add_Entry_ID_To_Redirect_URL;
    	}
    }

    and the only think you need to configure in this code is in this line

    private $form_id = 1155;//enter form_id here

    where you set the form ID.

    Then you can simply add your score={calculation-14} to redirect URL in form configuration (just like you would normally do) so the redirect URL would be like

    https://site.com/somepage/?score={calculation-14}

    You can add multiple vars like e.g.

    https://site.com/somepage/?score={calculation-14}&name={text-1}

    For as long as the form ID is correctly set, it will properly append entry_id to URL.

    I hope that helps!

    Best regards,
    Adam

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Adam,

    that is really great!!!
    works absolutely fabulous!!

    thank you very much

    cu

    lieuwe

    Thread Starter lieuwe1957

    (@lieuwe1957)

    Hi Adam,

    something new popped up, after installing your script: the form is storing the information correctly, but does not send an email anymore.
    regards

    Lieuwe

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @lieuwe1957,

    We would like to test your form to see what might be causing this behaviour. Could you please share the form export so that we could give a closer look and see what might be causing this?

    Please check the following doc on how to export a form:
    https://wpmudev.com/docs/wpmu-dev-plugins/forminator/#import-export

    You can share the export file via Google Drive, Dropbox or any such cloud services in the next reply.

    Looking forward to your response.

    Kind Regards,
    Nithin

Viewing 15 replies - 1 through 15 (of 19 total)
  • The topic ‘submission id / number’ is closed to new replies.