• Hi, thanks for your plugin, it’s working well.

    I need to add more shortcode placeholders to the mail content.

    In file wp-email-users.php I exchanged all lines:
    $mail_body = str_replace( $find, $replace, $_POST['wau_mailcontent'] );

    with this line:
    $mail_body = apply_filters( 'wau_mailcontent', str_replace( $find, $replace, $_POST['wau_mailcontent'] ), $user_id );

    Now I’m able to use the following kind of filter function to add any custom shortcodes to the mail content:

    function test_wau_mailcontent_replace( $content, $user_id ){
    	$find = "phone";
    	// assuming we have a phonenumber in usermeta with key 'crm_phone' 
    	$replace = get_user_meta( $user_id, "crm_phone", true);
    	$content = str_replace( $find, $replace, $content );
    	return $content;
    }
    add_filter('wau_mailcontent', 'test_wau_mailcontent_replace', 10, 2 );

    Would be really nice to see that filter in a next release.

    Thanks

    • This topic was modified 7 years, 7 months ago by jhotadhari. Reason: added markdown
    • This topic was modified 7 years, 7 months ago by jhotadhari.
    • This topic was modified 7 years, 7 months ago by jhotadhari.
    • This topic was modified 7 years, 7 months ago by jhotadhari. Reason: markup changes
    • This topic was modified 7 years, 7 months ago by jhotadhari.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Filter hook to change mailcontent’ is closed to new replies.