Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Created July 20, 2020 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewlimaza/ae5ec6383d4c9bff63a74af184231dea to your computer and use it in GitHub Desktop.
Save andrewlimaza/ae5ec6383d4c9bff63a74af184231dea to your computer and use it in GitHub Desktop.
Add !!user_id!! to Paid Memberships Pro Emails
<?php
/**
* Add's !!user_id!! variable to all Paid Memberships Pro emails.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_email_data_example( $data, $email ) {
$user = get_user_by( "login", $data['user_login'] );
$data['user_id'] = $user->ID; //adjust 'user_id' for the variable you want to use instead.
return $data;
}
add_filter( "pmpro_email_data", "my_pmpro_email_data_example", 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment