Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, if you just need the referrer to identify the enquiry comes from, you can take a small part of code from the link you provided. Put it to a plugin. This is the cleanest way an you can turn it on and off ;). I justed tested it and it works with caldera 1.7.6. (should also with the newer ones) …and actual WP Ver.

    Small manual:

    1. put a hidden field to your (copied) form an remember the field_id.
    2. make a Dir in your pluginfolder called ie ‘caldera-forms-send-referrer’
    3. make a php file called ‘cf-send-referrer.php’
    4. put some code to this file ie like this and change the field_id to yours:

    <?php
    /**
     * Plugin Name: Caldera Forms — Send referrer by hidden field
     * Plugin URI:  https://calderaforms.com/doc/caldera_forms_submit_post_process/
     * Description: Just puts the referrer to an hidden field
     * Version:     0.0.1
     * Author:      Shelob9, edited by st3phan
     * Author URI:  https://calderalabs.org
     * License:     GPL-2.0+
     * License URI: https://www.gnu.org/licenses/gpl-2.0.txt
     */
    
    // add action
    
    add_action( 'caldera_forms_submit_post_process', function( $form, $referrer, $process_id, $entry_id  ){
    
    	//make sure to set your field ID here, where to put the referrer.
    	$field_id = 'fld_1234567';
    
    	//get referrer 
    	$ref_url = $_SERVER["HTTP_REFERER"];
    
    	//change value
    	Caldera_Forms::set_field_data( $field_id, $ref_url, $form, $entry_id );
    
    }, 10, 4 );

    5. activate the plugin
    6. test it!

    Good luck

    • This reply was modified 5 years, 8 months ago by st3phan5.
    Thread Starter veeraj.john

    (@veerajjohn)

    Thanks a lot for your quick response again.
    I Have done the things the way you have said.
    But the referrer i am getting is the same contact form URL.

    P.s. Its a multipage form. If this helps.

    perhaps I misunderstood … :/

    okay, new question: Has every course its own slug in the permalink? If not the referrer might not really help you.

    With much more work you can do it a different way. Set each link to the form with some kind of ID/name to identify the course:

    Ie https://www.abc.com/enquiry/?crs=12345

    Now you can prefill your hidden field with {get:crs} as standard. You’ll get 12345 as value with the example above.

    This doesn’t use the referrer to identify the enquiry an you have to set each link manually … quite a lot of work providing up to 100 enquirys

    and an other last solution:

    if you embed the whole form via shortcode to your pages, you can set a default value to the needed field:

    https://calderaforms.com/doc/set-field-defaults-shortcode/

    This might work displaying always the same form for each type of enquiry while setting your hidden field to the desired value via shortcode.

    Good luck with this ??

    Thread Starter veeraj.john

    (@veerajjohn)

    @st3phan5 thanks for your response stephen..

    Yes, Every page has its own custom slug

    Solution 1:
    Its a huge task to go through each and every course page and do the URL Identifier. (probably will be my last option)

    Solution 2
    Also includes me doing the same stuff in all the course pages ??

    I am in need of the same thing, if you will know solution, please write here

    just picking up this thread … ??

    As far as tried myself using the plugin provided above, it should work. In my case a get the propper referrer (the page I came to the form). If you want to catch something else, try to modifiy the line where I write the referrer to $ref_url. You can use any php code you want.

    my case:
    page-with-link-to-form > page-with-form-through-shortcode > thank-you-page

    The ‘page-with-form-through-shortcode’ retreives the referrer and gets the url from ‘page-with-link-to-form’ as result.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Reffering URL’ is closed to new replies.