• I’ve been unable to get the pipes functionality (https://contactform7.com/selectable-recipient-with-pipes/) to work for a <select> element. The other support tickets related to this same problem have all been solved with workarounds. So, I went digging to see if I could figure out the problem. On line 313 of form-tags-manager.php is:
    $scanned_tag['values'] = $pipes->collect_befores();

    If this is changed to:

    $scanned_tag['values'] = $pipes->collect_afters();

    then the pipes start working as described in the above referenced article.

    Is it possible to check into this as a possible solution to the problem I and others have been experiencing with the pipes functionality? Thanks much for your help!

    EDIT: I take this back to some extent. It appears that this solution fixes the problem the first time the form is loaded. But in subsequent loads of the form, both the value and the label are the same once again. Could this be cache related? I think one of the other support tickets also mentioned this possibility.

    EDIT #2:
    Setting the ‘labels’ value within the pipes if/else appears to fix the issue:

    if ( WPCF7_USE_PIPE ) {
    	$pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] );
    	//$scanned_tag['values'] = $pipes->collect_befores();
    	$scanned_tag['values'] = $pipes->collect_afters();
    	$scanned_tag['pipes'] = $pipes;
    	$scanned_tag['labels'] = $pipes->collect_befores();
    	} else {
    	$scanned_tag['values'] = $scanned_tag['raw_values'];
    	$scanned_tag['labels'] = $scanned_tag['values'];
    }
    
    //$scanned_tag['labels'] = $scanned_tag['values'];
    • This topic was modified 5 years, 4 months ago by mkonji.
    • This topic was modified 5 years, 4 months ago by mkonji.
    • This topic was modified 5 years, 4 months ago by mkonji.
Viewing 1 replies (of 1 total)
  • Thread Starter mkonji

    (@mkonji)

    Hello again! I was just wondering whether there are any plans to take a look at and possibly implement the fix mentioned in the previous post (and below). I’ve made this edit in my local plugin, but that’s obviously terrible practice. Since others have reported this same problem (for instance, here: https://www.ads-software.com/support/topic/contact-form-7-pipes-not-working-3/ and here: https://www.ads-software.com/support/topic/pipe-not-working/), I am hoping the plugin can be updated and I can ditch my local changes.

    In summary: I had to make sure that if pipes were in use that the values were set to the value after the pipe (collect-afters()) and the labels were set to the values before the pipe (collect_befores()). If pipes are not in use, labels are simply set to values, but only in the case that pipes are not in use (i.e. inside the if/else statement instead of outside of it):

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

    Thank you for your consideration!

Viewing 1 replies (of 1 total)
  • The topic ‘pipes not working for elements – possible solution’ is closed to new replies.