Last active
July 25, 2019 08:56
-
-
Save andxbes/cb29eb2cb7af1392fb461c0dffed76a5 to your computer and use it in GitHub Desktop.
cf-7 append additional information to mail
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//see https://yadi.sk/i/M5hhJKkU3MkRdN | |
add_filter("wpcf7_mail_components", function($components, $curent_cf, $sender ){ | |
date_default_timezone_set('America/Sao_Paulo'); | |
$data = date("Y-m-d H:i:s"); | |
$components['body'] = str_replace("[protocol]", $data , $components['body'] ); | |
return $components; | |
},15,3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter('wpcf7_special_mail_tags', function($output, $name, $html) { | |
if ('protocol' == $name) { | |
date_default_timezone_set('America/Sao_Paulo'); | |
$data = date("Y-m-d H:i:s"); | |
return $data; | |
} | |
return $output; | |
}, 10, 3); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter("wpcf7_mail_components", function($components, $curent_cf, $sender ){ | |
date_default_timezone_set('America/Sao_Paulo'); | |
$data = date("Y-m-d H:i:s"); | |
$components['body'] = "Protocolo {$data} \n". $components['body']; | |
return $components; | |
},15,3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment