Group Announcements tab in BuddyPress

Cross-posted at the CUNY Academic Commons Development blog

I had a request or two to explain how I built the Group Announcements feature on the CUNY Academic Commons. Here goes.

Brief background: When the Commons was upgraded to BuddyPress 1.2, we got the benefit of interactive activity streams everywhere, including groups. This caused some confusion, however, as users were uncertain where conversation best fit into the Commons’s architecture: in the Forums (where it had been traditionally), or in the activity stream. In some communities this kind of fracturing might be okay or even welcome, but in ours it was confusing. At the same time, we wanted a way for group admins and mods to send important notices to the members of their groups. By taking the group activity updates and repurposing it as a Group Announcements section, I was able to kill two birds with one stone: providing an announcement space for mods, while focusing extended discussion in the forums.

You can download the CAC Group Announcements plugin here.

I’m not putting this in the repo at the moment because I don’t want to build a proper admin UI and support it :) For that reason, here is a primer on how the plugin works – if you want to customize or maintain it, you’re on your own, buster.

  1. The CAC_Group_Announcements class is an instance of the BuddyPress Group Extension API. It is responsible for creating the Announcements tab markup and adding it to the nav. You’ll notice that the majority of the markup is created by including bp-default’s activity-loop.php and post-form.php templates. You could customize this more if you wanted.
  2. bp_is_group_announcements() is a little template tag that can be used to test whether you’re looking at a group announcements page. This is needed for the activity filter, in step 3.
  3. cac_set_announcement_filter() adds a filter to the bp_has_activities query string when you are looking at an announcements page, so that it only displays activity items of the type activity_update. In other words, when you are looking at the regular activity stream for the group, you see all of the associated group activity items (new members, forum posts, etc) but when you’re on the announcements page you only see activity updates (which, remember, have been repurposed as announcements).

As I look at the code, I see that there are things I would definitely change if I were going to make this into a distributed plugin. If you want to make those changes, be my guest. You’re welcome to help each other in the comment section, but I won’t be formally supporting this, as it is a very basic hack that should happen at the theme level anyway. Good luck!

Group Announcements tab in BuddyPress by Boone Gorges, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

6 thoughts on “Group Announcements tab in BuddyPress

  1. Tammy

    Boone, thanks for this plugin. I’ve got what amounts to a totally newbie question — where, once the plugin is activated, does the admin go to post an announcement? I’ve been clicking around for an hour and must be blind! Thank you.

    Reply
    1. Boone Gorges Post author

      Hi Tammy,

      You’re welcome!

      The plugin is designed to create a new Announcements tab under each group. When you visit the tab logged in as a group mod or admin, you will see the post box at the top of the screen. Good luck!

      Reply
  2. Johnny

    How do I make this announcements tab BE the home tab? I’d prefer to keep all social activity in the forum…

    Cheers for any help guys

    Johnny

    Reply
  3. Amelia Manders

    Hi Boone,

    I know you’re not providing support for this, but maybe you can point me in the right direction. I installed this plugin and I’m able to create posts from the announcements tab, however, as soon as the screen is refreshed they are gone. Also, it looks like all activity is displaying on this tab. Do you have any idea what could be causing this?

    Thanks,

    Amelia

    Reply

Leave a Reply