Support » Plugin: Contact Form 7 Dynamic Text Extension » Not compatibility between shortcode

  • Hello guys:

    I’m using the next shortcodes:

    [dynamichidden cf7-counter “CF7_counter”]
    [dynamichidden nombretecnico “CF7_get_current_user key=’display_name'”]

    The counter that I use, the code in the functions.php is:

    //Define the key to store in the database
    define( 'CF7_COUNTER', 'cf7-counter' );
     
    //Create the shortcode which will set the value for the DTX field
    function cf7dtx_counter(){
        $val = get_option( CF7_COUNTER, 0) + 1;  //Increment the current count
        return $val;
    }
    add_shortcode('CF7_counter', 'cf7dtx_counter');
     
    //Action performed when the mail is actually sent by CF7
    function cf7dtx_increment_mail_counter(){
        $val = get_option( CF7_COUNTER, 0) + 1; //Increment the current count
        update_option(CF7_COUNTER, $val); //Update the settings with the new count
    }
    add_action('wpcf7_mail_sent', 'cf7dtx_increment_mail_counter');

    First I used the next shortcodes: [dynamichidden cf7-counter “CF7_counter”]
    [dynamichidden nombretecnico “CF7_get_current_user”]

    The counter worked fine, but when I added key=’display_name” to CF7_get_current_user, the counter It stopped working.

    How can I fix it?

    Thanks guys for this plugin, awesome.

  • The topic ‘Not compatibility between shortcode’ is closed to new replies.