indigo74
Forum Replies Created
-
I just noticed you added this workaround in your documentation https://betternotificationsforwp.com/documentation/adding-custom-shortcodes/
You’re welcome, by the way 😉
- This reply was modified 8 years, 4 months ago by indigo74.
Found a nice workaround 🙂
For your information, and for other users wanting to do the same, here is what I did:
Put this in your functions.php file:
/** wp_mail filter * Make sure shortcode are processed in mail body */ add_filter('wp_mail', function($args) { // Perform shortcode replace in message body $args['message'] = do_shortcode($args['message']); return $args; }, 1, 1);Works like a charm 🙂
Oh ok… I though it was something working… Damn 🙁
Isn’t it only a matter of performing a
do_shortcode()before sending?I can successfully use custom notification, such as [my-custom-shortcode], with BNFW for notification like “New Post”.
However, for notification like “New User – Welcome mail”, it is not working.
I am not talking about usual shortcode like [post_content] or [user_id] (as defined in http://betternotificationsforwp.com/documentation/notifications/shortcodes/), which works well. I am only talking about custom shortcode that I created in my functions.php file.
Of course, I use it like [my_custom_shortcode]
Other shortcodes work fine, like [global_user_lastname] and so on…
As I said, this is a custom shortcode that I defined in functions.php.
Example:
function my_custom_shortcode_fn($atts, $content = null) { error_log("shortcode"); ... return ''; } add_shortcode('my_custom_shortcode', 'my_custom_shortcode_fn');It works fine for notifications like New Custom Post. But not for “New User – for User”
I just added a review: ***** 5 stars!
Hope to see this feature coming some days.
Bye!