Skip to content

Instantly share code, notes, and snippets.

@evrpress
evrpress / gist:c2cc116114299a9ea79d
Last active August 7, 2016 09:48
Uppercase first and lastname
function my_uppercase_name( $data ) {
if(isset($data['firstname'])) $data['firstname'] = ucwords($data['firstname']);
if(isset($data['lastname'])) $data['lastname'] = ucwords($data['lastname']);
return $data;
}
add_filter( 'mymail_verify_subscriber', 'my_uppercase_name' );
@evrpress
evrpress / gist:eda7d379b9342663138c
Created February 23, 2016 13:22
Add custom header to MyMail
function add_custom_header_to_mymail($obj){
$obj->add_header('X-Custom-Header', 'Custom Value');
}
add_action('mymail_presend', 'add_custom_header_to_mymail');
@evrpress
evrpress / dynamic_tag.php
Last active January 20, 2016 14:56
Dynamic tags with option example
if ( function_exists( 'mymail_add_tag' ) ) {
function mytag_function($option, $fallback, $campaignID = NULL, $subscriberID = NULL){
if(1 == $option){
$link = 'http://exmaple.com/link1';
}else if(2 == $option){
$link = 'http://exmaple.com/link2';
}else if(3 == $option){
$link = 'http://exmaple.com/link3';
}
@evrpress
evrpress / gist:c57da52a3848305524e8
Last active January 13, 2016 15:56
Replacing certain strings
function my_mymail_text_strings( $translated_text, $org_text, $domain ) {
if($domain != 'mymail') return $translated_text;
switch ( $org_text ) {
case 'Search for Text to Replace' :
$translated_text = 'Replace it with this text';
break;
}
return $translated_text;
}