• Hi Takayuki,

    There is a fix for the bug encountered with pipes in options of select HTML element.

    File: includes/shortcodes.php, block lines 138 to 148

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

    The commented line can be deleted, it’s added to the “else” condition.
    Thank to the documentation, labels collect the element before the pipe, and values have to be the element collected after the pipe.

    Thank you for your work!

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    No, it’s not a bug, that is intended. Values have to be text before pipe because they are visible on HTML source.

    See Selectable Recipient with Pipes

    Thread Starter Geoffrey

    (@creativejuiz)

    Thank you for your quick answer.
    I understand.
    But without my fix, your example of code:

    [select your-recipient "CEO|[email protected]"
                        "Sales|[email protected]"
                        "Support|[email protected]"]

    doesn’t work.

    What is the solution?

    Have a nice day.

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    How “doesn’t work”?

    Thread Starter Geoffrey

    (@creativejuiz)

    Without my fix, the previous shortcode with pipes, from your documentation, give me this code in front :

    <select name="your-recipient">
        <option value="CEO">CEO</option>
        <option value="Sales">Sales</option>
        <option value="Support">Support</option>
    </select>

    When I apply my fix, the code generated becomes:

    <select name="your-recipient">
        <option value="[email protected]">CEO</option>
        <option value="[email protected]">Sales</option>
        <option value="[email protected]">Support</option>
    </select>

    Without my fix, pipes are useless.

    Sorry if it wasn’t understandable enought ??

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    It’s working correctly.

    Thread Starter Geoffrey

    (@creativejuiz)

    Hi Takayuki,

    I don’t understand why you are telling me “it’s working correctly”.
    To do the test on a real project, before your last plugin update (4.1, good work for that!) this code was working (because my fix was applied):

    [select* you-are id:you-are "...|" "An advertiser|advertiser" "An association|association" "An individual|individual"]

    After the plugin update, it does not work anymore.
    To make this code working, I simply apply the PHP code I give you.

    If this shortcode is supposed to work, why it doesn’t without my fix?

    Thank you and have a nice day.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘A fix for pipes' bug in’ is closed to new replies.