bbPress Notify (No-Spam)

Better Notifications for bbPress and BuddyBoss

Table of Contents

The Problem

bbPress is the most popular forum plugin for WordPress. It is active in over 200,000 sites at the time of this writing, and chock-full of features. Many of these features, however only provide basic functionality, which opens the opportunity for dozens of third party plugins to fill in the gaps.

In my first foray into the world of bbPress, I wanted to be notified of whenever a new topic or reply was created. Although the plugin offers a Subscriptions feature, where visitors can opt to receive an email whenever someone creates a new thread or reply, the actual message is basic and not customizable. Also, I wanted all admins to receive a notice without the need to having to go and subscribe to each forum or, even worse, to have to subscribe to each newly-created topic just so they get emails for new replies.

A Solution, but not quite

After a quick search at wordpress.org, I found a simple and little used plugin that did exactly that – for every new element, a message was sent to all admins. It also offered a template with basic merge tags, so the notifications could be customized.

I was quite happy with it for the first few days, until I started getting notified about spam messages – even if they had been captured by Akismet.

Being a plugin developer, I had a look at the code and realized that it did not check the post status of the new topic/reply and just sent out the notification anyway. The fix was fairly simple, really – just a couple of lines of code checking the status.

I could have simply changed my version to have it work as I wanted, but I knew that any updates to the plugin would overwrite my changes. In the spirit of collaboration, I reached out to the developer and shared my findings. Alas, he never got back to me. My code wasn’t added to his plugin either. In hindsight, I’m glad he didn’t.

bbPress Notify (No-Spam)

In the true spirit of Open Source software and the GPL, I decided to fork the plugin and release it on wordpress.org with my own changes. Thus bbPress Notify (No-Spam) was born. Little did I know that it was the beginning of something big.

A few hundred installs after I released my fork, users started sharing their own needs and wishes for my plugin. The most common request was to let them choose which roles were to be notified instead of limiting it to Administrators.

Once I implemented that feature, forum owners started selecting the Participant role so that *everyone* would receive notifications whenever a new topic or reply was posted, even if they hadn’t subscribed to the forum or topic. In other words, forum owners started spamming their participants! It’s one thing to notify admins who need to know what’s going on in their forums, but another thing altogether to send unsolicited emails to end users. The whole reason I had forked the plugin in the first place was to stop spammers after all.

Opting Out

I didn’t want to take the heat for how forum admins were using my plugin, so I had to think of something fast. Removing the feature was out of the question. Instead, I thought of a way to give the email recipients more power over what notifications they do get. Enter the bbPress Notify (No-Spam) Opt Out add-on.

Now users had a way to block all forum notifications, or only receive the ones for forums and topics that they were actually subscribed to. People were happy, so I was happy :). Things could have ended there, but I started getting requests for other features and many of them made sense. One such request was to hook into bbPress’ core Subscriptions functionality so admins weren’t forced to use roles. I implemented that, and the unintended result was a drop in Opt Out sales. After all, admins no longer *had* to use roles so only subscribers were getting notifications. There was no longer a need to opt out as they had explicitly opted in by subscribing to a forum or topic. Lesson learned, moving on.

Receiving Digests

The next thing people were getting complaints about was that visitors were getting too many notifications. Instead, they wanted to have one daily (or weekly or monthly) message with a summary of what went on in the forums.

I looked around for plugins that could do that but couldn’t find any. Sounded like a new business opportunity, so I got to work. It wasn’t simple. I had to add some hooks into bbpnns – that’s my pet name for bbPress Notify (No-Spam) – build a new table, set up scheduled hooks and so on.

The end result: bbPress Notify (No-Spam) Digests. It is one of my favorite projects, and the most popular plugin over at UseStrict Consulting. Over the years, it too got its own feature requests attended – such as giving the option to choose between the original summary body, or to send out messages containing the full content of each post.

Discussing by Email

Notifications, at this point, were a one way street – people would get notified of new topics and replies by email, but would have to log into the forums in order to participate. It would be so much better if they could simply reply to the message they just got, right?

Well, I thought so, too. But getting this project turned into a reality would be no easy task as the functionality is much more complex than the Digests plugin.

First, I had to figure out how I could relay the relevant information such as user ID, forum, topic, and reply-to fields. Sure, I could identify the user by the sender’s email address, but those can be spoofed and it would open the site for attackers to impersonate someone.

Then I’d have to figure out how to read the messages from the inbox, ignoring the ones that are not related to the forums as well as the always present auto-replies.

Parsing the emails would turn out to be a bit of a nightmare as each email client gets creative with the HTML used for their messages. Don’t even get me started on filtering out those phrases along the lines of ‘On such and such date, John Doe wrote:’ without removing too much content.

No wonder nobody wants to build, sell and maintain such a plugin! But all challenges aside, it’s been a really good addition for many users. My favorite use case is that of the forum dedicated to stroke survivors. Because many have mobility issues (read typing), they get to dictate their messages on their phones’ email clients and participate easily of all discussions.

After a few months of work, I finally released bbPress Notify (No-Spam) Reply by Email. I’m happy to say that it is very popular – right up there with the Digests add-on. It integrates nicely with Digests and also has some auto-subscription settings to help users get involved in all aspects of forum discussions. There is also the option to allow creating new topics by email.

Sending Emails in Bulk

With all of these emails going back and forth, we started seeing some cases where not everyone was getting notified. After a bit of investigation, I noticed that these sites had several hundred our a few thousand users. Now, the whole premise of bbpnns is to allow admins to personalize messages. This means that we cannot send one message to hundreds of recipients in the BCC field as they would all get the same exact email body (this is what bbPress does, by the way).

Because we’re sending individual messages to potentially thousands of users, the web server ends up killing the process due to it taking to long to complete.

This issue originally came up in the Digests add-on, and I tried forking the main process into child ones to try and trick the server into not killing the whole thing. This worked in a couple of cases, but it depended on how the PHP executable had been compiled. I realized that I needed a better solution – one that would work on all servers.

After some investigation of Mail services, I found that Mailgun and Sendgrid (the two most popular email services I could find) had the option of sending up to 1000 emails in a single API call. That was fantastic news!

The end result was bbPress Notify (No-Spam) Bulk Mailer. Yes, it requires a subscription with one of Mailgun or Sendgrid, but that’s really a good thing. Not only do you get to ensure that all of your recipient notifications leave the web server, but you can also take advantage of the third-party logging and tracking of those messages.

Playing Nicely with Other Plugins

It is no secret that WordPress has a LOT of plugins available. With almost 60 thousand free plugins (at the time of this writing) and who knows how many premium ones, it stands to reason that bbPress itself would also have a lot of add-ons available to customize forum user experience.

Most of the bbPress customization I’ve come across is in the form of creating private groups or enforcing specific access for certain members with a plethora of membership plugins.

The problem with these is that bbpnns didn’t really know how to deal with them. For instance, if bbpnns was set to send messages per roles and an admin had made it so that some members could access a specific subset of forums, all members would eventually get notified of new topics and replies that they didn’t have access to.  Another case was for sites that were using BuddyPress or BuddyBoss and their Groups feature. There was no way to make bbpnns understand that only group members were supposed to be notified. This was obviously a bad thing.

I needed to address these issues, but I could not simply add code for every single possibility out there into bbpnns as it would end up bloating the plugin with code that not everybody needed. The solution came in the form of multiple smaller Bridge add-ons.

From working with BuddyPress/BuddyBoss, to Private Groups, and several membership add-ons, the Bridges help bbpnns to send messages to the right people, without spamming anybody.

Click here to see our full list of third-party bridges to bbpnns.

What Next?

bbPress Notify (No-Spam) is the best notification plugin for bbPress, if I do say so myself :). The ecosystem around it makes it that much more powerful.

If you have a bbPress forum or are thinking of setting one up, personalized email notifications is something you should not overlook. Do yourself (and your visitors) a favor and install bbpnns. Then take it up a few notches with our premium add-ons and I’m confident that your visitors will love it.