WordPress.org

Ready to get started?Download WordPress

Forums

Contact Form 7
select with pipe (2 posts)

  1. adjosan
    Member
    Posted 2 years ago #

    hello

    i want to use pipe for select option like
    [select name "name1|1"]
    the site show <option value="name1">name1</option>
    but i want <option value="1">name1</option>

    do you think why ?

    i'm using contact form 7 3.3.1
    in wp-contact-form-7.php there are lines :
    if ( ! defined( 'WPCF7_USE_PIPE' ) )
    define( 'WPCF7_USE_PIPE', true );

    thanks for your answer.

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

  2. FranH
    Member
    Posted 2 years ago #

    I have the same problem!

    I'm using this:
    [select country "AFG|Afghanistan" "ALB |Albania" ............... (many indeed). ..... .. .. ]

    Now this worked ok before last update! I'm very sure of it, But unfortunately I'm not sure what was the version before update :(

    I've fixed it in plugin source, but hope I won't have to do it after next update.

    Here is what I changed:

    includes/pipe.php, line 55:
    ADD THIS

    function collect_afters() {
    	$afters = array();
    
    	foreach ( $this->pipes as $pipe ) {
    		$afters[] = $pipe->after;
    	}
    
    	return $afters;
    }

    END ADD

    includes/shortcodes.php
    CHANGE lines 113 - 123 like this:

    if ( WPCF7_USE_PIPE ) {
    	$pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] );
    	$scanned_tag['values'] = $pipes->collect_befores();
    	$scanned_tag['pipes'] = $pipes;
    	$scanned_tag['labels'] = $pipes->collect_afters();
    } else {
    	$scanned_tag['values'] = $scanned_tag['raw_values'];
    	$scanned_tag['labels'] = $scanned_tag['values'];
    }
    
    // $scanned_tag['labels'] = $scanned_tag['values'];

    END CHANGE

    Now, I have no idea if that was a good thing to do or what, maybe the plugin author will enlighten us :)

    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.