Plugin / AsynCRONous bbPress Subscriptions

Markus Echterhoff

Description

Description

Per default, bbPress is sending subscription notification emails as one email with a bunch of BCCs. There are various reasons why it would make more sense to send individual emails. This plugin does that, quietly in the background via WP cron, without slowing down page load times. Also increases notification performance and reduces database load on large sites.

Translations by @mauriciogarofalo and @mechter

Defaults

If you don’t customize this plugin, this is what you’ll get:

  • Sends mails from "MyBlog <[email protected]>" (with your Blog’s name and admin email)
  • Sends mail to "Markus <[email protected]>" (with the name being the user’s display name on the forums, not their username)
  • Subject and Message have more user friendly defaults, use the available filters (see below) to make them your own.

Customization

You can install and activate this plugin and it just works, but you have full control over the details if you want to. Below are some filters and code snippets that help you do what you want. If you’re new to working directly with code, please see the example at the bottom of this page.

Available filters

bbp_subscription_email_from( $from ) // $from can be a string or array('name'=>string, 'address'=>string)
bbp_subscription_email_recipients( $recipients ) // $recipients is array of array('name'=>string, 'address'=>string)
bbp_subscription_email_headers( $headers )
bbp_forum_subscription_email_subject( $subject, $forum_id, $topic_id )
bbp_forum_subscription_email_message( $message, $forum_id, $topic_id )
bbp_topic_subscription_email_subject( $subject, $forum_id, $topic_id, $reply_id )
bbp_topic_subscription_email_message( $message, $forum_id, $topic_id, $reply_id )

bbp_bounce_address( $bounce_address )

bbp_subscription_disable_async( false )
bbp_forum_subscription_disable_async( false )
bbp_topic_subscription_disable_async( false )

Helpful Snippets

Here are some pointers to get the data you might want in your notifications:

$blog_name = get_bloginfo( 'name' );

$forum_title = bbp_get_forum_title( $forum_id );

$topic_author_user_id = bbp_get_topic_author_id( $topic_id );
$topic_author_display_name = bbp_get_topic_author_display_name( $topic_id );
$topic_title = wp_specialchars_decode( strip_tags( bbp_get_topic_title( $topic_id ) ), ENT_QUOTES );
$topic_content = wp_specialchars_decode( strip_tags( bbp_get_topic_content( $topic_id ) ), ENT_QUOTES );
$topic_url = get_permalink( $topic_id );

$reply_author_user_id = bbp_get_reply_author_id( $reply_id );
$reply_author_display_name = bbp_get_topic_author_display_name( $reply_id );
$reply_content = strip_tags( bbp_get_reply_content( $reply_id ) );
$reply_url = bbp_get_reply_url( $reply_id ); // note that it's not get_permalink()

Example

To have a nice subject line for new topic notifications, add this to your theme’s functions.php. If your theme does not have this file, you can simply create it and it will be loaded automatically. Note how the example is basically just one of the filters above, mixed with some of the snippets and a return statement. It’s that simple.

add_filter( 'bbp_forum_subscription_email_subject', function( $subject, $forum_id, $topic_id ) {
    $blog_name = get_bloginfo( 'name' );
    $topic_author_display_name = bbp_get_topic_author_display_name( $topic_id );
    $topic_title = wp_specialchars_decode( strip_tags( bbp_get_topic_title( $topic_id ) ), ENT_QUOTES );
    return "[$blog_name] $topic_author_display_name created a new topic: $topic_title";
}, 10, 3); // first is priority (10 is default and just fine), second is number of arguments your filter expects

Ratings

5
8 reviews

Rating breakdown

Details Information

Version

3.6

First Released

11 Mar, 2015

Total Downloads

3,481

Wordpress Version

3.6 or higher

Tested up to:

5.0.7

Require PHP Version:

-

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.