Created
March 19, 2018 15:50
-
-
Save pbrocks/15f9bf47280cb39dc655cb133486b7ea to your computer and use it in GitHub Desktop.
This filter function creates a variable from Usermeta to be used with PMPro emails.
This file contains hidden or 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
/** | |
* This filter function creates a variable from Usermeta to be used with PMPro emails. | |
* | |
* The function returns a variable prepared for the special html syntax within PMPro emails. In this example, the value of the array key 'favorite_color' is returned and can be used in emails with the html placeholder !!favorite_color!!. | |
*/ | |
function pmpro_usermeta_in_email_data( $usermeta, $email ) { | |
global $current_user; | |
$usermeta['favorite_color'] = get_user_meta( $current_user->ID, 'favorite_color', false ); | |
return $usermeta[0]; | |
} | |
add_filter( 'pmpro_email_data', 'pmpro_usermeta_in_email_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment