Skip to content

Instantly share code, notes, and snippets.

@jondcampbell
Last active January 31, 2016 23:55
Show Gist options
  • Save jondcampbell/d7682fcf68ecd7a48bd1 to your computer and use it in GitHub Desktop.
Save jondcampbell/d7682fcf68ecd7a48bd1 to your computer and use it in GitHub Desktop.
Theme my login replacement variables filter. Used to add your own variables to the Custom Emails module of theme my login. Uses tml_replace_vars.
function custom_email_replace($old_replacements, $user_id){
// Generate the new url we need for this user
$enrollment_form_url = 'special-url-'.$user_id;
// An array of our replacement variables and their values
$new_replacements = array(
'%enrollmentform%'=> $enrollment_form_url,
);
// Merge our two arrays together
$replacements = array_merge($old_replacements, $new_replacements);
// Return the array of all the replacements
return $replacements;
}
add_filter( 'tml_replace_vars', 'custom_email_replace', 99, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment