WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7 Dynamic Text Extension
Save and retrieve form fields with cookies (1 post)

  1. digilb
    Member
    Posted 1 year ago #

    I read on http://sevenspark.com/free-stuff/contact-form-7-dynamic-text-extension-released about a fix for using cookies to store information.

    I created a new short code and added it to the plugin file

    /* Insert the referrer id via url or cookie */
    function cf7_referrer(){
    if(isset($_COOKIE["Referrer"])) { $val= $_COOKIE["Referrer"]; } else { $val = $_GET["id"]; } return $val;
    }
    add_shortcode('CF7_REFERRER', 'cf7_referrer');

    and then added to header file

    <?php if(isset($_COOKIE["Referrer"])) { } else { $refer = $_GET['id']; setcookie("Referrer", $refer, time()+3600); } ?>

    I'm trying to replicate this on a website I'm building, but it doesn't work.
    What I did:
    1) I pasted the first piece of code at the end of the file
    wp\plugins\contact-form-7-dynamic-text-extension\wpcf7_dynamic_text.php
    2) I pasted the second piece of code
    wp\themes\twentytwelve\header.php
    before the line </head>
    3) I uploaded both files to the webserver

    This didn't work, so I guessed I needed to use the new shortcode CF7_REFERRER somewhere.
    I looked in the Contact Form 7 plugin and changed the line
    [dynamictext* your-name "CF7_GET key='your-name'"]
    into
    [dynamictext* your-name "CF7_REFERRED key='your-name'"]
    but this didn't help.

    I would be very greatful if someone could explain me which step I'm missing.

    http://wordpress.org/extend/plugins/contact-form-7-dynamic-text-extension/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags