• Resolved lukesimoncurtis

    (@lukesimoncurtis)


    Hi there – I can’t seem to get this function to fire and pre populate the address field on my contact form with anything at all… any ideas?

    
    add_filter( 'cf7_2_post_filter_cf7_field_value', 
    'field_default_value',10,5);
    
    function field_default_value($value, $cf7_id, $field, $cf7form_key, 
    $form_terms){
        if('your-address' == $field){
           global $current_user;
           //get your user's address
           $value='test';  
       }
      return $value;
    }
    

    It’s loaded on the page with

    [cf7-form cf7key="untitled-2"]

    And the field on the form is:

    <div class="input-area"> Address: *[text* your-address class:input-box] 
    </div>

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Aurovrata Venet

    (@aurovrata)

    Is your form mapped? if the form is not mapped or in draft map mode, this hook will not fire.

    If your form has a ‘Save’ tag, allowing users to save draft submissions before final submission, this hook will fire initially the first time a user loads the form, but if that user saves a draft and revisits the form, they will see their saved values and therefore this hook will not fire.

    Thread Starter lukesimoncurtis

    (@lukesimoncurtis)

    I’m not sure if I’m following – I want it to function as a standard contact form but the address of the current user be pre-populated i.e. no drafts or saves, just a simple send?

    Plugin Author Aurovrata Venet

    (@aurovrata)

    Is your form mapped?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Function not firing’ is closed to new replies.