Patch for flamingo module
-
I make a patch into modules/flamingo.php
with this patch cf7 send to flamingo “Mail subject” and “Mail from” if this field is set into cf7 form.For example:
“Mail from” cf7 form
[your-fistname] [your-surname] [your-email]
“Flamingo from”
value_of_your-firstname value_of_your-surname
“Mail subject” cf7 form
[field-subject]
“Flamingo subject”
value_of_field-subjector
“Mail from” cf7 form
[your-fistname] [your-lastname] [your-email]
“Flamingo from”
value_of_your-firstname value_of_your-lastname
“Mail subject” cf7 form
My site example.com [field-subject]
“Flamingo subject”
My site example.com value_of_field-subjectI test patch against:
WordPress ver. 3.6, Contact Form 7 ver. 3.5.2 and Flamingo ver. 1.0.4
all work fine for me.change lines (modules/flamingo.php) 45 and 46:
$name = isset( $posted_data['your-name'] ) ? trim( $posted_data['your-name'] ) : ''; $subject = isset( $posted_data['your-subject'] ) ? trim( $posted_data['your-subject'] ) : '';
with this:
/* check for mail subject */ if( isset( $contactform->mail['subject'] ) and !empty( $contactform->mail['subject'] ) ) $mail_subject_data = $contactform->mail['subject']; else $mail_subject_data = null; if( ( $mail_subject_data != null ) and ( strlen( trim( $mail_subject_data ) ) > 0 ) ){ preg_match_all( "/\[(\S*?)]/", $mail_subject_data, $mail_subject_out, PREG_PATTERN_ORDER ); if( isset( $mail_subject_out[1] ) and !empty( $mail_subject_out[1] ) ){ foreach( $mail_subject_out[1] as $key ){ $mail_subject_data = str_replace( "[".$key."]", $posted_data[$key], $mail_subject_data ); } $subject = trim( $mail_subject_data ); }else{ $subject = isset( $mail_subject_data ) ? trim( $mail_subject_data ) : ''; } }else{ $subject = isset( $posted_data['your-subject'] ) ? trim( $posted_data['your-subject'] ) : ''; } /* end check for mail subject */ /* check for mail sender */ if( isset( $contactform->mail['sender'] ) and !empty( $contactform->mail['sender'] ) ) $mail_sender_data = $contactform->mail['sender']; else $mail_sender_data = null; if( ( $mail_sender_data != null ) and ( strlen( trim( $mail_sender_data ) ) > 0 ) ){ preg_match_all( "/\[(\S*?)]/", $mail_sender_data, $mail_sender_out, PREG_PATTERN_ORDER ); if( isset( $mail_sender_out[1] ) and !empty( $mail_sender_out[1] ) ){ foreach( $mail_sender_out[1] as $key ){ $mail_sender_data = ( $key == 'your-email' ) ? str_replace( "[your-email]", '', $mail_sender_data ) : str_replace( "[".$key."]", $posted_data[$key], $mail_sender_data ); } $name = trim( $mail_sender_data ); }else{ $name = isset( $mail_sender_data ) ? trim( $mail_sender_data ) : ''; } }else{ $name = isset( $posted_data['your-name'] ) ? trim( $posted_data['your-name'] ) : ''; } /* end check for mail sender */
- The topic ‘Patch for flamingo module’ is closed to new replies.