Skip to content

Instantly share code, notes, and snippets.

@andrewlimaza
Last active February 19, 2025 08:44
Show Gist options
  • Save andrewlimaza/3f5198d9c6a45ce27d5cfa5b07c75dd0 to your computer and use it in GitHub Desktop.
Save andrewlimaza/3f5198d9c6a45ce27d5cfa5b07c75dd0 to your computer and use it in GitHub Desktop.
Custom !!denied_reason!! for Approvals Denied Email Templates.
<?php
/**
* Add a custom field !!denied_reason!! to be used in Approvals Denied Email.
* Add this code to your site by following this guide - https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/
*/
function my_pmpro_denied_message( $data, $member ) {
$denied_reason = get_user_meta( $member->ID, 'my_field_key', true ); // Change 'my_field_key' to the meta key of your custom field.
$data['denied_reason'] = $denied_reason;
return $data;
}
add_filter( 'pmpro_approvals_member_denied_email_data', 'my_pmpro_denied_message', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment