[Plugin: Contact Form 7] Pipes : get before value
-
Hi !
i don’t know if this topic has already been discussed but this is how i achieve to get the “before” value of pipes.
I use pipes for choising recipients depending on the subject as described here :
https://contactform7.com/2009/11/26/selectable-recipient-with-pipes/
but i wanted to set the subject of the sented email with the choosen label.
What i did is to modify the file ‘includes/classes.php’ in the mail() function and replace l. 308-321 by :
if ( WPCF7_USE_PIPE && is_a( $pipes, 'WPCF7_Pipes' ) && ! $pipes->zero() ) { $this->posted_data[$name.':before'] = $value; if ( is_array( $value) ) { $new_value = array(); foreach ( $value as $v ) { $new_value[] = $pipes->do_pipe( stripslashes( $v ) ); $new_value_before[] = $v; } $value = $new_value; $this->posted_data[$name.':before'] = $new_value_before; } else { $value = $pipes->do_pipe( stripslashes( $value ) ); } }
And now, i can use the following shortcode :
[your-subject:before]
to output the label of ‘your-subject’ instead of the value.It’s maybe not a very good way to achieve this. It really is a quick and dirty mod but for me, it works.
- The topic ‘[Plugin: Contact Form 7] Pipes : get before value’ is closed to new replies.