Cross-posted at the CUNY Academic Commons Dev Blog
Rodney Blevins and Marius Ooms wrote a fantastic plugin for BuddyPress called Groupblog, which allows BP groups to easily create a blog associated with their group. The killer feature of the plugin is the ability to add all group members to the blog (as authors, editors, subscribers, whatever you’d like) in a more or less automatic fashion – a far, far easier task than adding users manually through Dashboard > Add User.
I found, though, that the process wasn’t quite as automatic as I’d like. They’d based the code for adding users on a plugin by Burt Adsit called Community Blogs. Community Blogs only triggered the user adding process on a one-by-one basis: members of a group weren’t added to the group’s blog until they visited the blog. This is problematic for a few reasons. First, it’s an added step that creates some confusion among group admins and members, who assume that community blog membership should be automatic. Second, we’ve enabled various levels of privacy for blogs at the CUNY Academic Commons, and group members who were not yet members of a private group blog couldn’t really visit the blog to kick start the process. (Strictly speaking, that’s not true: the add user process was hooked to a process that took place when the blog’s login screen popped up, which happens when you persistently try to visit a blog to which you don’t have access. But this is extremely confusing.)
I took a bit of time today to rework how Groupblog handles the add user process. With the new setup, every member of a group is added to the group blog at once. The process is put into motion when the blog’s administrator updates and saves the group’s Group Blog settings. Other members of the BP community who join the group after the initial blog setup are added automatically to the blog as well, in accordance with the settings that the admin has determined for member permissions.
All the changes I made to the plugin are found in the main plugin file, bp-groupblog.php. You can download the modified file here: bp-groupblog.php.txt (don’t forget to make sure that the file is named bp-groupblog.php to make the plugin work). Just replace the stock version of the file with this one to make the changes. I intentionally did not clean up the plugin – all the original code is deactivated but still present beside the new code – because I wanted users to be able to differentiate what I had written from what the original authors had written (at least for now).
Thanks Boone, we’d love to incorporate this into the plugin and give credit to your work. It is great to have people develop along side each other.
Greetz,
Marius
It’s my pleasure, Marius. I think your plugin is killer, and I’m happy to contribute to its development in any way that I can.
I tried to make a note in the plugin wherever I changed or added a function, but there are probably a few places where I had to change a line or two but neglected to leave a comment. You might want to do an svn diff to get a clear picture of exactly what I changed (or if you want, I can make one and send it to you).
Thanks for your work on the plugin.
Boone – I’m finding bp-groupblog broken with wpmu 2.9.1.1. Does God have a solution?
Separate issue- When you cross post at CUNY Academic Commons Dev Blog, are you using the feedwordpress plugin or other plugin or just manually?
Hi Mark. What do you mean bp-groupblog is broken? What happens? What version of BP are you running?
I just crosspost manually. I suppose I could set up FeedWordPress to grab posts from a certain category (as they do at http://dev.wpmued.org, where some of my posts go) but I never set it up that way. FWP makes it easy, though, because WP creates a feed for every category and every tag (though the tag feeds break if you’re using Feedburner).
It broke for me when I upgraded wpmu to 2.9.1.1 from 2.8.6. Have you upgraded to 2.9.1.1 without a problem? I’ve disabled plugins with no change in the status of groupblog. I only made one change (updated wpmu) and Groupblogs immediately broke.
Pages load fine if not a Group page. Selecting any Group results in a blank page with the following error printed at the top:
Call to undefined function bp_groupblog_is_blog_enabled() in /bp-groupblog/bp-groupblog.php on line 127
wpmu – 2.9.1.1, bp – 1.1.3, bp-groupblog 1.3.1
While one other has reported this problem. Someone else appears to have no problem:
http://buddypress.org/forums/topic/bp-groupblog-error-call-to-undefined-function
I asked about your use of feedwordpress due to the challenge I’m having of using it for a course blog on a buddypress site. Individual posts on students’ pages are feed to the Course site (that’s good) but it creates double posts in the BP Activity Stream. The Reverend got me hooked but I’m thinking life would be easier without it… Feedwordpress works much better when it pulls from a site that is external from the wpmu/bp site.
My issue was fixed by adding code to make sure buddypress was loaded before the plugin. I guess this should be the first thing to consider with all plugins that break running wpmu 2.9.1.1.
More details:
http://buddypress.org/forums/topic/bp-groupblog-error-call-to-undefined-function
Thanks for sharing the solution, Mark! I’ll have to go back and fix all my plugins before 1.2 drops.
As for your BP Activity Stream issue, there are a couple ways to handle it. Right now I’m working on a plugin that will serve as a robust solution, but in the meantime you can work around the problem by hacking your activity loop template file. Make sure there’s a copy of /activity/entry.php in your child theme (preserve the directory structure or it won’t work). Then put the entire content of the file in the following conditional statement:
current_activity;
$classblogs = array( 1, 2, 6, 10 ); // Populate this array with the blog ids of the blogs you don't want to appear on the activity stream, ie the class blogs
$showme = 1;
$blog_id = 1;
if ( $activities_template->activities[$this_id]->component == BP_BLOGS_SLUG ) {
$blog_id = $activities_template->activities[$this_id]->item_id;
if ( in_array( $blog_id, $classblogs ) )
$showme = 0;
}
if ( $showme = 1 ) {
?>
// the existing template goes here
On an unrelated note, do you do everything the Reverend tells you to do? 🙂
Mark – WordPress is messing with the formatting on that comment, but you can figure it out – make sure to remove the spaces between opening brackets and question marks in the php tags.
Bavatuesdays was what moved me from Joomla to WordPress. So let me quote the Bava site:
“My understanding is that an essential requirement of the internet is to do whatever Jim Groom asks of you while you’re online.” -James D. Calder
****I am finding a quirk with the groupblogs plugin – specifically related to the content of your post (Streamling). After upgrade of plugin with above mentioned code to load bp first, regular Group members are no longer being automatically added as Blog members. If I promote a group member to Admin or Moderator, they then are automatically added to the Group Blog (with the correct Blog privileges). I can then demote them back to regular members and their Blog privileges change accordingly. It’s interesting that promotions to Admin & Mod both result in automatic Blog membership but being added initially as a regular group member does not. Thoughts?
Hello,
Doesn’t work for me 🙁 Users can’t write into blog.
Also, i can’t activate blog of group or publications for members in the administration of groupblog.
Any ideas ?
Thanks 😉
NB : i use buddypress 1.2, groupblog 1.3.1, wordpress mu 2.9.1
Hi HollowMac,
I have heard from multiple people that Groupblogs might not be working properly on BP 1.2. Search around http://buddypress.org/forums to find out more about that. In any case, you should no longer have to use the code that I supply in this post, because the authors of the groupblog plugin have added my changes to the version of the plugin available in the repository.
Try downloading the latest version from the repo. If it still doesn’t work for you, you might want to contact the authors of the plugin. I will probably have a look at the plugin sometime myself, but it might not be in the next few weeks.
Hi, just wanted to share that in the next days we are releasing an updated plugin! If there are other features you would like to see implemented, now is the time.
Greet,
Marius
Great news, Marius! Thanks for letting us know – and for your hard work on this crucial plugin.
I’ve been getting this error with group blogs under the tab in the group.
Catchable fatal error: Obect of class WP_Error could not be converted to string in /web/sites/wordpressmu292/wp-includes/wp-db.php on line 488
Any ideas how I can fix it?
Matthes – There’s not much I can tell from that error message – it just says that something has gone wrong, and WP doesn’t know how to report it correctly. I’d ask the question on http://buddypress.org/support/topics/, and hope that the plugin author can get in touch with a possible solution.