Skip to content


New BuddyPress / bbPress plugin: Group Forum Subscription

BuddyPress and bbPress connect nicely, giving BuddyPress groups a handsome forum interface, but the software has no native ability to allow users to receive email when their favorite discussions are updated. Without this functionality, it can be hard for users to keep up-to-date with forums, and subsequently the forums are less active than they otherwise could be.

Subscription panel on group home page

A panel on each group home page lets users know whether they'll automatically receive email notifications of new discussion activity in the group

Group Forum Subscription is a set of plugins I’ve written (mostly on the BuddyPress side, with a small bbPress trigger plugin) that adds the missing forum notification functionality. GFS allows members of BuddyPress communities to subscribe to email notifications of new discussion activity. Subscriptions can be managed on a topic-by-topic or group-by-group basis.

Users can subscribe or unsubscribe from entire groups on the Notification Settings page

Users can subscribe or unsubscribe from entire groups on the Notification Settings page

The plugin also has some administrative settings. Notable among these is the ability to set up email notifications for the first time after the plugin is installed, so that users are automatically subscribed to topics in their groups without having to set it up manually. This is a setup process that we’ll be running in the upcoming days here on the CUNY Academic Commons.

Group Forum Subscription will currently work only on 1.0.x versions of BuddyPress – the brand-new BP 1.1 is not yet supported. I’ll be working on the upgrade very soon. Read more about the guts of the plugin or download it for yourself.

Posted in Plugins and Extensions.

Tagged with , , , , , , .

2 Tweets


32 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

  1. Simon says

    Very good plugin, comes in very handy and I’m sure this will help keep the forum-community together. I will wait until it’s made 1.1. compatible though.

    One thing I could not yet get working properly is the Mediawiki implementation. I think it might be connected with the htaccess mods, in which htaccess is that placed, in wiki/htaccess?

    Thanks a lot and keep them coming Boone

  2. Profile photo of Boone Gorges Boone Gorges says

    Hi Simon – You and other might like to know that I upgraded the plugin today so that it works with BP 1.1. You can download it here: http://wordpress.org/extend/plugins/group-forum-subscription-for-buddypress/installation/

  3. Ray says

    Hey Boone,

    I got the following errors when using the plugin:


    Warning: Missing argument 2 for gfs_send_email_notification() in /var/www/example.com/wp-content/plugins/bp-group-forum-subscription.php on line 110

    Warning: Missing argument 3 for gfs_send_email_notification() in /var/www/example.com/wp-content/plugins/bp-group-forum-subscription.php on line 110

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/example.com/wp-content/plugins/bp-group-forum-subscription.php:110) in /var/www/example.com/wp-content/plugins/buddypress/bp-core.php on line 924

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/example.com/wp-content/plugins/bp-group-forum-subscription.php:110) in /var/www/example.com/wp-content/plugins/buddypress/bp-core.php on line 925

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/example.com/wp-content/plugins/bp-group-forum-subscription.php:110) in /var/www/example.com/wp-includes/pluggable.php on line 856

    Using BP 1.0.2 on WPMU 2.7.1.

  4. Profile photo of Boone Gorges Boone Gorges says

    Hi Ray. Thanks for finding this bug.

    Strangely enough, the bug should (so far as I can see) break the email notifications in 1.0.3, but it was working fine on my installation. I don’t have a 1.0.2 install handy, so I can’t easily test, but the fix I’ve made ought to work (it was something very small). Grab the most recent version from svn or http://wordpress.org/extend/plugins/group-forum-subscription-for-buddypress/ or the WP plugin updater and see if the error still pops up.

  5. Ray says

    Hey Boone,

    Just checked the newest version in trunk.
    That fixed the problems!

    One other bug:
    -on lines 192 and 211, change the function calls to gfs_bp_add_user_favorite() instead of just bp_add_user_favorite()

    Also, I have some additional feedback:
    -I’m getting some unwanted HTML tags in the body of the email. I think this is probably because I removed the kses filter in the BP forums for my own usage.

    I’ve modified the gfs_send_email_notification() function a bit. Here are my changes if you’re interested:
    http://pastebin.com/me67e5d1

    -is the forum poster supposed to get an email copy of the same post as well? I think an email should only be sent if the post is written by anyone except the logged-in user. This technique is used by the Subscribe to Comments plugin.

  6. Profile photo of Boone Gorges Boone Gorges says

    Wow, thanks for catching those incorrect function calls, Ray! After staring at these things enough, function names tend to blur :) I’ve made the changes in trunk.

    As for the HTML in emails: yes, it’s definitely related to kses. I was getting some annoying square bracket tags in emails, so instead of tracking down their origins I just stripped them out of the email text. Thanks for sending your changes, though – I may borrow your regex next time I do a real update.

  7. Ray says

    Hey Boone,

    Sorry to bug you again!

    Just checking the contents of the group email and noticed that the forum thread is using the bbPress permalink.

    I think that those of us using < BP 1.1 might want to use the BP permalink instead of the bbPress link. Might be good to make this an admin option.

    Just checked your BP group forums to see how you were handling this and I see that you're redirecting group forums over to their bbPress equivalents, which is great!

    May I ask what code snippet you're using to do this?

  8. Ray says

    Sorry for bombarding this comment stream!

    Another enhancement:
    -the “Forum subscription” block on the BP group homepage should only be shown if the user is logged in


    if ( bp_group_is_visible() && bp_group_is_forum_enabled() && function_exists( 'bp_forums_setup') && is_user_logged_in() ) { ?>

  9. Ray says

    Okay more bug fixes!

    This is for the bbPress trigger plugin.

    In the footer of the email, the notification settings link is for the post author’s account. It should be linking to the sent user’s account instead.

    One line 85 in bb-group-forum-subscription, change get_user_name($bb_current_user->ID ) to:
    $userdata->user_login

    Also on the plugin forum thread on buddypress.org/forums, I’ve posted a fix for the database connection issue:
    http://buddypress.org/forums/topic/group-forum-subscription#post-25678

    Boone, which site do you prefer comments about your plugin to go to? BP forums, CUNY dev or Teleogistic?

  10. Ray says

    Forgot to post another line change in the previous comment!

    Line 98 of bb-group-forum-subscription.php needs the user_login column selected in order for the sent author’s username to be echo’ed in the footer.

    $all_users = $bbdb->get_results("SELECT ID, user_email, user_login FROM $bbdb->users WHERE user_status=0");

  11. Profile photo of Boone Gorges Boone Gorges says

    Ray – Thanks for the bombardment. I appreciate the patches very much. (BTW, either here or Teleogistic is fine for comments – the BP forums get a little out of hand, though.)

    I hadn’t thought of the logged-in-users-only point, but I think that’s important. Otherwise non-logged-in users probably get a PHP errors.

    Good find with the bbPress notification email. I could swear that I already fixed that bug, but it must have been in the BP emails because I don’t remember the neat little user_login trick that you’re using here. Good idea, I will definitely fix that.

    To respond to a question that you asked somewhere about the links in emails going going to BuddyPress forums and having an admin option for bbPress v BP: funny that you mention it, I actually had such an admin option in the <1.0 version of the plugin. (Check the svn/tags.) I took it out because the point becomes sort of moot in 1.1, where bbPress is all but hidden from view. But on further consideration I suppose it doesn't hurt to put it back in, so I should probably do that.

  12. MarkS says

    I just posted this at wordpress.org but this is obviously a better place:
    wpmu: 2.8.4a bp:1.1.1 – originally I used the auto install but then corrected the install per readme file. I was hoping that moving the bp-group-forum-subscription.php file to directly in the plugins directory would fix the problem. It didn’t. Still same error.

    Installed and activated. At ‘Notification Settings’ page I select a group discussion to subscribe to. Saving Changes worked but resulted in the following error. I can recreate the error by going to the ‘Notification Settings’ page and Saving (this is even with no subscriptions to any group discussions).

    Warning: Invalid argument supplied for foreach() in /home/xxxxxx/public_html/wp-content/plugins/bp-group-forum-subscription.php on line 304

  13. MarkS says

    On the General Settings page I’m now get:
    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ” was given in /home/xxxxx/public_html/wp-includes/plugin.php on line 414

    Deactivating this plugin removes the error. Any thoughts would be appreciated. Thanks!

  14. Profile photo of Boone Gorges Boone Gorges says

    Hi MarkS –

    I did catch a little bug in the code that might have been causing your “Invalid argument supplied for foreach()…” problem, especially when subscribing or unsubscribing to groups that have no forum topics. I applied a patch and resubmitted – grab the plugin again from the repository http://wordpress.org/extend/plugins/group-forum-subscription-for-buddypress/ and see if it helps.

    I don’t know for sure what is happening with your second problem, related to the General Settings page. Hopefully it is solved by this fix.

  15. MarkS says

    Thanks for the quick reply. The first issue was fixed. No error and subscriptions to groups now work properly. Previously it said I was subscribed to a group, but I wasn’t. I could subscribe to a Topic. Now that occurs automatically when subscribed to a group.

    The second error, Warning: call_user_func_array(), still occurs. Of note it actually does not occur when selecting the ‘General’ (My Account > Settings > General). If I select ‘General’ – no error. The error occurs when selecting ‘Settings’ (under My Account). The ‘Settings’ and ‘General’ page look the same but must be making different requests given the two results I described.

  16. Profile photo of Boone Gorges Boone Gorges says

    Hi MarkS. I’m unable to reproduce this problem on my end, and I must admit that I’ve never seen this kind of issue before. Given that the error points to a part of WP code that is called when a plugin function is hooked, and given that your problem is happening on the BP settings page, I’m guessing that line 373 in bp-group-forum-subscription.php is the problem. A couple possibilities:
    – There might be a plugin conflict. Are you running any other BP plugins that add options to the BP settings pages? Try turning them off and see what happens.
    – You might try to alter the priority of the function hook on line 373. Change the number 10 to something else – try 5, try 20 – to reduce the possibility of conflicts.
    Aside from this, I guess I would need to see the contents of your PHP error log to have a better idea where the problem is coming from.

  17. WestPointer says

    BG – great product! I’m also experiencing the problem described by MarkS when clicking “settings”. I’ll try to troubleshot more.

    The bigger issue I’m seeing is that (with BP 1.1 and the plugin file you loaded yesterday), is that members are not automatically subscribed to a topic. gfsub_# is set to “yes” for that member but the auto subscribe does not happen. I’ll look at it more later but thought I’d bring it to your attention.

    I’m the author of the forum notification plugin (http://wordpress.org/extend/plugins/buddypressbbpress-email-notification/) but you are way ahead of me. No need for me to further invent the wheel!

  18. MarkS says

    Thanks for the suggestions Boone. Since WestPointer is having the same problem, I’ll share some feedback in hopes it helps development (and me!). The ‘Warning: call_user_func_array()’ error continues with all plugins disabled. bp-groupblogs is creating problems in the error_log but disabling it did not correct the problem of focus here. I also changed the priority on the function hook resulting in no improvement. Only disabling group-forum-subscription kills the error. I’ll email my error log to Boone.

  19. Profile photo of Boone Gorges Boone Gorges says

    Thanks as always for the feedback, guys.

    I think I have tracked down both problems. I was not able to produce the call_user_func_array problem that MarkS describes, but I did discover that for some reason I had specified more arguments for the hook bp_notification_settings than actually exist (in fact, it has none!). It could be that our versions of PHP are configured differently, so that mine does not throw up this particular error. In any case, I have removed the arguments and I’m hoping that it will resolve the issue.

    As for WestPointer’s problem – great catch. The hooks for new post and topic creation in BP 1.1 were changed. I caught the new ‘new post’ hooks, but the new ‘new topic’ hooks eluded me. That’s why members weren’t being subscribed to new topics. I believe it’s fixed now – please take a look.

    And yes, WestPointer, I totally agree that we should not reinvent the wheel! Where your plugin works better (for instance, Mike Pratt and I have been going back and forth on the buddypress.org forums about your coming improvements to the contents of the email that is sent on new posts), I really hope you’ll share the code so that we can merge and make this functionality as rich as possible.

  20. WestPointer says

    The “auto subscription” is working! Excellent. However, no email is generated when a new topic is created. Is it suppose to be sent?

    Unfortunately, the other error is still there – “Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ” was given in /home/mjpratt/public_html/wp-includes/plugin.php on line 414″. I see that if I click on my username in the top left, then select “Settings” I’ll try to look at that in more detail.

    Thanks!

  21. Profile photo of Boone Gorges Boone Gorges says

    Hi WestPointer – Oops, I forgot to add the new topic hook to the email sender. The trunk version should work now.

    I am stymied by that error you’re getting. Can you tell me more about your setup? Versions of WPMU, BP, and PHP if you have it. I could trace the problem if I was able to reproduce it, but I can’t!

    A little more info about the error would be good too. Does it print at the very top of the page, and then print the rest of the page? Or does it keep you from seeing the Settings page? Does it happen when you click on General or Notifications, or only when you click the Settings link in the optionbar?

  22. WestPointer says

    I’m still not getting an email sent on when a new topic is created but I know exactly where the problem lies.

    First, I had to change the variables in the function “gfs_new_topic_send_email_notification” to the format $topic->topic_poster_name instead of $topic[‘topic_poster_name’].

    The problem now is that when “gfs_send_email_notification( $last_post );” is called inside the “gfs_new_topic_send_email_notification” function, the variables need by “gfs_send_email_notification” aren’t all there.

    So when in “gfs_send_email_notification”, the statement “if (in_array( $topic_id, $user_faves )) {” has a blank value for $topic_id. That variable is expected in $args2 but since $args2 is not set, it defaults to 0.

    I hope that makes sense!

  23. Profile photo of Boone Gorges Boone Gorges says

    Hi WestPointer –

    That totally makes sense. I must look like kind of a dummy for having all these things break, but the BP 1.0 – 1.1 transition has been a bit of a pain. The way bbPress works in 1.1 is, as you know, much different, and all the data that used to come from bbPress as arrays is now stored in BP objects. The main site I’m using the plugin for myself is running BP 1.0.3, so I haven’t been paying as much attention to the 1.1 issues as I should.

    In any case, your suggestions led me to understand that I had to reorganize the code a little bit so that the right kind of data is fed into the gfs_send_email_notification function. I’ve done a fair amount of testing on BP 1.0.3 and BP 1.1.1 (or trunk, I forget) and, knock on wood, it seems to be working correctly. Please have a look.

    Also, I have another theory about the culprit of the PHP error. It has to do with the way that nav items are hooked in BP 1.1+, something that I had failed to notice when upgrading the plugin for the new version of BP. Since I wasn’t getting the error to begin with, I can’t be sure whether my fix has solved the problem, but I think it might. Please let me know either way.

    I can’t thank you enough for all your patient help.

  24. WestPointer says

    BG – great work! Thanks for all your continued effort. The error message is GONE and the emails are now going out when a new topic is created. Awesome!

    The only problem I’m seeing right now is that when I go to a group home page, under the “Forum subscription” section, no topic titles are listed.

    Thanks! I’ll try to examine the above issue more tomorrow.

  25. Profile photo of Boone Gorges Boone Gorges says

    Great news, WestPointer! Glad it works.

    I think you’re probably seeing what you’re supposed to be seeing under the Forum Subscription section – it’s coded to show whether you’ll automatically be subscribed to discussions in that group (the same metadata as in Settings > Notifications), not to list all forum topics. I thought listing topics would be redundant, since they’re already listed down under the Active Forum topics section. But, now that I think about it, maybe it would be nice to remove the standard Active Forum topics selection and replace it with a list of recent topics that also has subscription info on it. Maybe in a future version I’ll make this happen.

    Thanks for all your troubleshooting and patience!

  26. Erich says

    is this feature available in BP-Core now ?
    Not sure……

  27. Profile photo of Boone Gorges Boone Gorges says

    Erich – No, it’s not. But if you’re going to run a BP 1.2+ site, you probably shouldn’t use this plugin. Use http://wordpress.org/extend/plugins/buddypress-group-activity-stream-subscription/ instead.

Continuing the Discussion

  1. Academic Commons News » Blog Archive » New Feature: Email Notifications of Forum Posts - building CUNY Communities since 2009 linked to this post on October 1, 2009

    […] more on this new feature, please check out New BuddyPress / bbPress plugin: Group Forum Subscription, a post by our developer Boone Gorges. We’re very proud of Boone’s work on this plugin, […]

  2. Buddypress for WPMU - New BuddyPress / bbPress plugin: Group Forum Subscription – CUNY … linked to this post on October 1, 2009

    […] Read the original here: New BuddyPress / bbPress plugin: Group Forum Subscription – CUNY … […]

  3. Group Forum Subscription v1.1 – CUNY Academic Commons Development Blog linked to this post on October 10, 2009

    […] you’re using Group Forum Subscription for BuddyPress, you might like to know that I’ve just pushed out v1.1. There’s nothing new in terms of […]



Some HTML is OK

or, reply to this post via trackback.

*
To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image

Additional comments powered by BackType



css.php