Blogs@Baruch, now with BuddyPress!

I recently completed a significant upgrade to Blogs@Baruch, and I thought I’d blog my hacks and some of the thinking behind them for teh Google to index.

The goal of the upgrade was to get BuddyPress up and running, which will create additional avenues for social publishing and networking around academic interests across the College. The upgrade included two new WordPress child themes, one that uses bp-default (for the home site and all BuddyPress functionality) and one that uses TwentyTen (a new default theme).

if ( is_user_logged_in() )

Since we’re rolling BuddyPress into a system that’s been active for almost two years already, and which has more than four thousand users, I was hesitant to just automatically give everybody public profiles or to make the member list publicly visible. The following simple argument came in very handy in these cases:


<?php if ( is_user_logged_in() ) : ?>
<?php else : ?>
<?php endif; ?>			

I snaked this code through functions in a number of places:

  • in header of the BP child theme to hide the Members list (by excluding the page id for the Members page in the “else” statement)
  • in sidebar.php file of my child theme, to give logged-in users relevant quick links
  • in members/index.php of my child theme, to hide the Members directory
  • in members/single/home.php to hide individual Profile pages

I also hide the BP admin bar for logged out users (which is an option built into BP)… So if you’re a visitor to the site, BuddyPress won’t be visible to you.

Logged out:

Logged in:

This is the way we’re going to keep it for now, and I think such a structure reflects our sense of BuddyPress primarily as a tool for the community to get to know itself a little better. Rumor has it that some more granular privacy control will be coming down the pike in future versions of BuddyPress, and we’ll revisit this issue as appropriate.

bp-custom.php etc.

Every BuddyPress install should have a bp-custom.php file located in wp-content/plugins/ which houses customizations. I used this file to change the order of the tabs on Profile pages, and to insert additional menus on the BuddyPress admin bar.

One of the great challenges I’ve had is the fact that one of my good buddies and partners in pizza-eating crime has become one of the top BuddyPress/WordPress developers around, and Boone’s on my IM rolls. I’m often faced with the dilemma of taking an hour to figure something out, or bothering him and getting some code in about 3 minutes. He helped me with code for the tab order:


function change_profile_tab_order() {
	global $bp;

	$bp->bp_nav['profile']['position'] = 10;
	$bp->bp_nav['activity']['position'] = 20;
	$bp->bp_nav['blogs']['position'] = 30;
	$bp->bp_nav['friends']['position'] = 40;
	$bp->bp_nav['messages']['position'] = 50;
	$bp->bp_nav['groups']['position'] = 60;
	$bp->bp_nav['settings']['position'] = 70;
}

add_action( 'bp_setup_nav', 'change_profile_tab_order', 999 );

The additional menus in the admin bar, I figured out with help from the Codex:


function my_help_link(){
  ?>
  <li><a href="http://blsciblogs.baruch.cuny.edu/support/explanation-of-buddypress/">HELP!</a>

 <ul class="wp-admin-bar">
<li><a href="http://blsciblogs.baruch.cuny.edu/support/guide-to-buddypress/">Guide to Buddypress</a></li>
  <li><a href="http://blsciblogs.baruch.cuny.edu/support/for-blog-authors/">Support for Students</a></li>
  <li><a href="http://blsciblogs.baruch.cuny.edu/support/for-blog-administrators/">Support for Faculty</a></li>
  <li><a href="http://blsciblogs.baruch.cuny.edu/contact/">Contact</a></li>
  </ul>
  </li>
  <?php
}
add_action( 'bp_adminbar_menus', 'my_help_link', 14 );

function quick_links(){
  ?>
  <li><a href="http://blsciblogs.baruch.cuny.edu/support/explanation-of-buddypress/">Quick Links</a>

 <ul class="wp-admin-bar">
  <li><a href="http://blsciblogs.baruch.cuny.edu/about-blogsbaruch/terms-of-service/">Terms of Service</a></li>
  <li><a href="http://www.baruch.cuny.edu/blsci">BLSCI</a></li>
  <li><a href="http://www.baruch.cuny.edu/bctc">BCTC</a></li>
  <li><a href="http://www.baruch.cuny.edu/">Baruch College</a></li>
  </ul>
  </li>
  <?php
}

And, with Boone’s help, I made a change to my wp-config.php file so that Profile (rather than the Activity Stream) became the default component loaded when you visited a member’s page. (I located this line of code just beneath the “/* That’s all, stop editing! Happy blogging. */” comment, as it didn’t work when I put it at the end of the wp-config.php file).


 /** Sets BP Nav to load Profile first */
define( 'BP_DEFAULT_COMPONENT', 'profile' );

These changes are intended to prioritize Profiles. We want our users to share information about themselves and to use Boone’s Custom Profile Filters to connect with others at the College with similar interests. While the CUNY Academic Commons, for which that plugin was written, hopes to connect CUNYs across campuses, we want do this on a more local scale. When all of our incoming students get their Blogs@Baruch accounts next week, they will be asked to fill out their profiles and to begin exploring.

New Default Theme

I also used the upgrade opportunity to create a new default theme for sites created on Blogs@Baruch, a child of TwentyTen which features some Baruch College and CUNY branding/linking and altered css. Aided by this tutorial, I swapped out the built-in header images that ship with TwentyTen for images taken from Baruch College’s library of photographs. Here’s the code for that, placed into the theme’s functions.php file:


define( 'HEADER_IMAGE', get_bloginfo('stylesheet_directory') .'/images/headers/baruchcollege.jpg' );

add_action( 'after_setup_theme', 'blogsatbaruch_setup' );
function blogsatbaruch_setup(){

/* Add additional default headers: All Photos are from Baruch College Visual Standards Library: http://www.baruch.cuny.edu/visualstandards/photos.htm */

	$blogsatbaruch_dir =	get_bloginfo('stylesheet_directory');
	register_default_headers( array (
		'Baruch' => array (
			'url' => "$blogsatbaruch_dir/images/headers/baruchcollege.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/baruchcollege-thumbnail.jpg",
			'description' => __( 'Baruch College', 'blogsatbaruch' )
		),
		'Elevators' => array (
			'url' => "$blogsatbaruch_dir/images/headers/elevators.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/elevators-thumbnail.jpg",
			'description' => __( 'Elevators', 'blogsatbaruch' )
		),
		'Reading' => array (
			'url' => "$blogsatbaruch_dir/images/headers/reading.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/reading-thumbnail.jpg",
			'description' => __( 'Reading', 'blogsatbaruch' )
		),
		'Streetsign' => array (
			'url' => "$blogsatbaruch_dir/images/headers/streetsign.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/streetsign-thumbnail.jpg",
			'description' => __( 'Street Sign', 'blogsatbaruch' )
		),
		'Turnstiles' => array (
			'url' => "$blogsatbaruch_dir/images/headers/turnstiles.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/turnstiles-thumbnail.jpg",
			'description' => __( 'Turnstiles', 'blogsatbaruch' )
		),
		'VC View' => array (
			'url' => "$blogsatbaruch_dir/images/headers/vcview.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/vcview-thumbnail.jpg",
			'description' => __( 'View from VC', 'blogsatbaruch' )
		),
		'Windows' => array (
			'url' => "$blogsatbaruch_dir/images/headers/windows.jpg",
			'thumbnail_url' => "$blogsatbaruch_dir/images/headers/windows-thumbnail.jpg",
			'description' => __( 'Windows', 'blogsatbaruch' )
		),

	));
}

function remove_twenty_ten_headers(){
	unregister_default_headers( array(
		'berries',
		'cherryblossom',
		'concave',
		'fern',
		'forestfloor',
		'inkwell',
		'path' ,
		'sunset')
	);
}

add_action( 'after_setup_theme', 'remove_twenty_ten_headers', 11 );

And here’s what it looks like:

This new theme is sharper than what previously loaded, and TwentyTen is customizable enough that I think a lot of our users will just keep it as their primary theme.

Bye Bye Userthemes

Finally, I’ve done away Userthemes on Blogs@Baruch. The last two WP upgrades have required hacks to keep the plugin only half-working (I’ve never been able to turn off Userthemes on blogs… once you go Userthemes you’ll never go back!). It’s such an important part of what we do on the system that I wanted to cease relying on such an unstable plugin. Instead, with Tom Harbison’s help, we copied all of our custom themes into the theme library and renamed their folders to the site id for which they were intended. We didn’t activate these themes site wide, but rather went one by one through the blogs, editing the template, stylesheet, and theme settings for each. Not the perfect solution, but it feels more stable than relying on Userthemes.

Those are the hacks that I remember. I’m sure there are a few that I missed.

If you’d like to take a look at the child themes, here they are: Blogs at Baruch BP (child of bp-default) and Blogs at Baruch (child of TwentyTen).

Slouching Towards BuddyPress

planet of the apes
Creative Commons License photo credit: waferboard

I’m preparing to roll BuddyPress out on Blogs@Baruch later this month, and I’ve grown a little concerned about the implications of doing so. I thought I’d write up some of my concerns and see if the Internets has anything wise to say about them.

Our goal in using BuddyPress is to try to draw out and congeal an academic publishing network out of the various work that’s being done across the system. We hope to give students a platform to track their work over their careers at the College, to make connections with students with similar interests, and to cultivate a profile in a space they’re somewhat familiar with that we can support and that they can build as they desire. But I’m anxious about a few things.

First, we already have more than four thousand users on Blogs@Baruch, and the vast majority of those accounts were created for course-based blogging. I’m uneasy about turning on profile pages for users who never used the system for that purpose, without their knowledge. My current plan is to send an email out to all users when we turn on BP with instructions about granular control of profile pages. But, as far as I know, that control can only be so granular: with BuddyPress Profile Privacy you can set privacy on a field-by-field basis, but you can’t lock a whole profile page down. I’m hoping Jeff Sayre’s Privacy Component, which apparently is nearing a second beta, can help solve this problem. We’ll be registering incoming first year students for Freshman Seminar and instructing them on how to use the system beginning in August, and we’ll keep Profile pages set to “open” for new users from that point forward (we’ll be updating our woeful Terms of Service as well).  I think it might make sense though to lock-down already existing accounts and outreach to those users with details about BuddyPress’s purpose and instructions on how to manage their profile privacy. I’m uncertain about this, though, both the ethics and how I’d manage this technically.

Second, I’d like for the primary engine of Blogs@Baruch to continue to be course-based blogging. BuddyPress, however, elevates the social networking function to equivalence with the blogging functionality of a WP-MS installation. We’re not building ePortfolios like our friends at Macaulay and don’t have the resources to closely support the development of profiles on a system as big as ours. And I certainly want to avoid the creepy treehouse factor, which is an issue with incoming Freshman.  I just want students to use BuddyPress@Baruch to connect with each other around interests and academic work. So there are a few spots where I’d like to make some choices or changes that could nurture that understanding; for instance, I don’t think I’ll have a link to the members directory from the front page (but have it publicly accessible via internal links); I’ll hide the BuddyPress admin bar for logged out users; and, I’d like to hack BuddyPress so that upon log in, instead of landing at the front page of the home blog, users land at the Dashboard for their primary blog. Any other ideas?

Third, I have to revisit our registration process. In most classes, we use DDImportUsers to bulk register new users. Our most technologically capable faculty members can handle the intimidating two-step of a “self-registration” and the addition of Andre Malan’s “Add User to Blog” widget. Now, with BuddyPress functionality turned on, registration can become more complicated and require more information, which is fine for self-registering users but potentially problematic for those who are bulk-added. The bulk process also only creates new accounts, which I’ve been struggling with for some time; existing users need to be added to new sites individually, and to do so you need both a username and an email address (if I had my druthers, the DDImportUsers plugin would be able to check a list of newusernames|newemailaddress against the user_email field in the wp_users table and if a email address exists, add the user with that address to the individual site… and then to go on to register all the new users).

As the system grows, this is becoming a bigger problem since every semester a higher percentage of Baruch students have accounts on the system and find their way into new classes that use it. In an older version of WPMu you were able to add users to individual blogs simply with an email address, which was preferable because the cross-referencing is a pain. But that pain is balanced on the other side by the agita that would be caused if nervous first-time blogfessors are made to manage a multi-step registration process. In the past, I’ve taken the pain on in exchange for the benefit of drawing more users onto the system, and it’s been a good trade. I’m not sure yet how BuddyPress fits into this equation and how it will impact my overarching goal of easing the registration process, but wanted to get the issue out there. In the long term we’re looking at LDAP integration, but we’re not there yet. One solution is BP Group Blogs; but that creates additional steps in the registration process and we still want to make things as sleek and streamlined as possible.

These are my concerns for now, and I’m sure there’ll be more to come… any feedback, questions, and exchanges from out there in the wild are welcome and greatly appreciated.