Advertisement
designbymerovingi

Transfer Messages in Emails

Mar 23rd, 2017
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.66 KB | None | 0 0
  1. /**
  2.  * Add Transfer Message to Emails
  3.  * @since 1.0
  4.  * @version 1.0
  5.  */
  6. function mycred_pro_add_transfer_message_to_emails( $body, $email, $addon ) {
  7.  
  8.     $data    = $email['request']['data'];
  9.  
  10.     // Default text to show if no message was given
  11.     $message = 'No message';
  12.  
  13.     // This is where the message should be stored
  14.     if ( is_array( $data ) && ! empty( $data ) && array_key_exists( 'message', $data ) )
  15.         $message = $data['message'];
  16.  
  17.     // Replace our custom template tag with the actual message
  18.     return str_replace( '%transfer-message%', $message, $body );
  19.  
  20. }
  21. add_filter( 'mycred_email_message_body', 'mycred_pro_add_transfer_message_to_emails', 10, 3 );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement