Jefferson’s Newspaper

Creating a Blog Topics Directory in WPMU 2.8 + BuddyPress 1.1

buddyPress-alt
I recently set up an installation of WordPress MultiUser (WPmu) + BuddyPress for the History Department where I work.  We have a number of different user groups on the site, including Courses, Workshops, and Projects.  Eventually we will also have Personal sites (for students, staff, and faculty in the dept.) and perhaps some small organizations and campus groups.  Right now the site is small, so it would be reasonable to manually create and maintain a topical directory.  As the site grows, however, this could become a burden to say the least.  Nobody likes to do that kind of crap – not even graduate assistants.  So with the help of an outdated plug-in and a couple of tiny hacks, I easily created a directory of Blogs by Topic so I never need to hand code the directory.  Read on to find out how.

To begin with, I’m using Deanna Schneider’s very handy Blog Topics For WPMU. Basically, Blog Topics creates a field in the relevant Settings, Registration and BuddyPress areas in which your users choose from a drop-down of admin-defined topics.  They cannot create new topics, they must use the ones you set, so keep that in mind.  The Site Admin can manually set the Topic for any blog at any time; this might be necessary if you already have a handful of blogs on your site (or you could demand that your users do it themselves because this is all about being lazy).  Some users might misfile their site in the wrong category, but you can always go in and edit any blog’s Topic; they probably won’t even notice.

You might be wondering why I would write a tutorial for installing a plug-in.  Well, I’m not sure if the plug-in code has some deprecated elements or if it just doesn’t play nice with the new BuddyPress theme structure, but it’s actually a bit more complicated than just installing the plug-in. For whatever reason, the documentation for this plug-in is pretty weak and some of it just doesn’t seem to work without some tweaks.  That’s where I come in to sum up my hours of frustration with what now seems like an obvious process.

Here’s the drill…

  1. Install the plug-in in your wp-content/plugins folder and activate it on your parent site.  The plug-in comes with a nice little widget for your MU child sites, but it won’t help you here so consider it optional.
  2. Inside the wp-content/plugins/blog-topics directory, you will find the file cets_blog_topics_page.php (a WordPress page template).  Copy this file to the root of your site’s parent theme file. If you are using BuddyPress 1.1, that means themes/bp-sn-parent.
  3. Now, take that file and mess it all up according to the instructions below. Unfortunately, in the plug-in’s current state (v. 0.3.2), the default file just doesn’t work, but after digging around in the code, I found some functions that work quite nicely and can be easily integrated into your BuddyPress directories. Again, you will need to save this to the root of your theme.
  4. Create a page called Blog Topics Directory (or whatever) and apply the Blog Topics Page template you just created.
< ?php
/*
Template Name: Blog Topics Page
*/
?>
< ?php get_header(); ?>
 
	<div id="content" class="narrowcolumn">
 
		< ?php do_action( 'bp_before_directory_blogs_content' ) ?>
 
		<div class="page" id="blog-page">
 
			< ?php if (have_posts()) : while (have_posts()) : the_post(); ?>
 
				<h2 class="pagetitle">< ?php the_title(); ?></h2>
 
                                <!--using anchors for long lists, or you could use something fancier to browse topics-->
 
					<ul id="topic-list">
					<li><a href="#topic1">Topic 1</a></li>
					<li><a href="#topic2">Topic 2</a></li>	
					<li><a href="#topic3">Topic 3</a></li>	
					<li><a href="#topic4">Topic 4</a></li>	
					<li><a href="#topic5">Topic 5</a></li>	
					</ul>					
 
<!--add the numeric Topic ID according to the models below-->	
 
<!--topic1-->
<a name="topic1"></a>
<h2 class="pagetitle">< ?php echo cets_get_topic_name('1') ?> Blogs</h2>  
< ?php echo cets_get_blogs_from_topic_id_html('1'); ?>
 
<!--topic2-->
<a name="topic2"></a>
<h2 class="pagetitle">< ?php echo cets_get_topic_name('2') ?> Blogs</h2>  
< ?php echo cets_get_blogs_from_topic_id_html('2'); ?>
 
<!--topic3-->
<a name="topic3"></a>
<h2 class="pagetitle">< ?php echo cets_get_topic_name('3') ?> Blogs</h2>  
< ?php echo cets_get_blogs_from_topic_id_html('3'); ?>
 
<!--topic4-->
<a name="topic4"></a>
<h2 class="pagetitle">< ?php echo cets_get_topic_name('4') ?> Blogs</h2>  
< ?php echo cets_get_blogs_from_topic_id_html('4'); ?>
 
<!--topic5-->
<a name="topic5"></a>
<h2 class="pagetitle">< ?php echo cets_get_topic_name('5') ?> Blogs</h2>  
< ?php echo cets_get_blogs_from_topic_id_html('5'); ?>
 
 
 
 
			< ?php endwhile; endif; ?>
 
		</div>
 
		< ?php do_action( 'bp_after_directory_blogs_content' ) ?>
 
	</div>
 
< ?php get_sidebar(); ?>
 
< ?php get_footer(); ?>

You could probably find any number of ways to integrate this into your theme’s Blog Directory. Although I might eventually change it, right now, I’ve just added a link to the Blog Directory sidebar which users can… use… to Browse Blogs by Topic. If it helps, here’s a link to the site where this code is being used. Again, it needs some tweaking but this should get you started. Hope this quick fix has helped.

If you’re wondering why this post has a giant image of Brak (among other notable “buddies”) at the top, or if you just need a break from all this BuddyPress nonsense, you might need to listen to this…

Brak sings Yeah Buddy (via brakbuddy.ytmnd.com)

Author: E. Bell

Category: Reference

Tagged: , , , , , ,

8 Responses

  1. Great write up and tip, but I have a couple questions.

    1. Following your link above, I don’t see a “Browse Blogs by Topic” area. Have you turned off this functionality?

    2. Have you alerted Deanna Schneider of the issue with her plugin and BuddyPress? I’ve had an opportunity to communicate with her a few times regrading her plugins and she’s usually quick to correct any issues.

    p.s. I found your post via a Google Alert for “wpmu”.

  2. E. Bell says:

    Hi Adam, thanks for the comment. To answer your questions…

    1. For the time being, I just linked it in the sidebar here: http://clevelandhistory.org/blogs (it goes to http://clevelandhistory.org/topics/)

    2. No, I have not alerted Deanna. I figured BuddyPress 1.1 just came out so it might take some time for an update (if indeed BP changes are to blame). You are correct though that contacting her would be a good idea. I literally just discovered and implemented the plugin (and then wrote the post) yesterday so I hadn’t even considered it. Good lookin’ out.

  3. Andrea_R says:

    Yep, she;s pretty good about updating. As far as I know, she did not develop this for use on buddyPress – just WPMU. I’ve used it plenty of times with no issues.

    (and in the mu-plugins folder, not the plugins folder)

  4. jamesdcalder says:

    Hey man,

    Jim Groom just published another piece on WPMU. http://bavatuesdays.com/faq-for-universities-interested-in-wpmu/ Since you’re not on g chat today, I’ll leave the address here. Check it out!

  5. Justin Hons says:

    I just to know if the accompanying graphic is an EB original. If so, dude, you have arrived. Genius.

  6. Justin Hons says:

    I just WANT to know…

  7. r-a-y says:

    Still trying to grasp my head around the whole “topics” thing.

    So during the blog registration process, the user gets to select a few “topics” that the admin sets up.

    In your example, you made the following “topics”:
    -Courses
    -Workshops
    -Projects
    -Organizations
    -Personal

    Basically, it’s another way of categorizing your blogs on WPMU, correct?

    I’ll have to play with this later… some screenies of the admin area and blog registration page would have been nice.

  8. Hi,

    Great article! I would like to repost this blogpost on my BuddyPress tutorial site, because I think it’s a very useful tutorial. Could you please let me know if you agree with this (it’ll be a guest post from you of course!)

    Greetings,
    Bowe

Leave a Reply

Recent Posts

  • Why We Blog? Time. Community. Hubris.
    Feb 2, 2010
    Recently, I had a conversation about blogging with my partner, who is a Montessori teacher.  Often times as we share a ride home from work, she will discuss some aspect of her work day that leaves me impressed with her knowledge and insight about teaching and child development. ...
  • A Sililoquy on the Cassette Tape and other Analog Wonders
    Jan 7, 2010
    Yes, I know it's 2010 (pronounced "twenty-ten"), and I know that nostalgia for the analog age is a 30-something cliche, and I know the cassette has become a sickening node of ironic culture.  But for just a few minutes, I ask you to set aside your pernicious Family Guy-inspired liking for hackneyed 80s references to consider the cassette as it should be understood: as a lost assertion of our basic rights, a technological and social artifact,  and a symbol of friendship, grassroots culture and low-fi audiophilia. ...
  • Adding an Image Lightbox in Omeka
    Nov 19, 2009
    Maybe it's just me, but I had a heckuva time trying to figure out how to implement Lightbox 2 in Omeka. After piecing together info and code from here and there, then adding my own little improvements, I've constructed a simple little 4-step guide to document the process and, hopefully, help make this process a little less vexing for others out there who aren't PHP and Java Script pros. ...
  • Creating a Blog Topics Directory in WPMU 2.8 + BuddyPress 1.1
    Oct 6, 2009
    I recently set up an installation of WordPress MultiUser (WPmu) + BuddyPress for the History Department where I work.  We have a number of different user groups on the site, including Courses, Workshops, and Projects. ...
  • The Spectacle, the Social Web and You
    Sep 26, 2009
    "The only historically justified tactic is extremist innovation" - Debord & Wolman, A User's Guide to Détournement (1956) I've been thinking about the Situationists for about a decade now, after learning of Guy Debord's Society of the Spectacle in some Propagandhi liner notes (I think) about a decade ago. ...
  • Building a WordPress Static Homepage with Dynamic Elements
    Sep 22, 2009
    One of the nice features of WordPress is the ability to create static homepages.  While most blogs use the standard configuration, where users scroll vertically from the most recent to older blog posts, it often makes sense to use a static homepage instead -- especially if you are looking to create a more professional looking site, or are using WordPress as a Content Management System. ...
  • Liberal Guerillas to Fling Terror Poo at G-20 Summit!
    Aug 11, 2009
    I will rarely address current events on this site, but a friend of mine in PA sent me a link to a completely ridiculous story from KDKA TV News Pittsburgh, a CBS affiliate.  Hit the break for the video and the full story, annotated with my first hand clarifications. ...
  • Experimenting with Historical Thinking and Web 2.0: The Little Rock Nine
    Jul 27, 2009
    Somewhat self-righteously, I consider myself a pretty good teacher.  I teach high school modern American History on the west side of Cleveland where some consider making it to the end of the day a victory. ...
  • Podcasts for History Teachers and Students
    Jul 19, 2009
    I'm one of those people who listens to NPR all day.  In the shower, in the car, while cooking, as a Sunday morning activity with my partner.  I almost never watch television, but I love passively listening to smart people talk, which is not really substantially different than watching dumb people swap wives when you get down to it. ...
  • Overheard in the Learning Management System
    Jul 4, 2009
    Like any zealot, I spend weekends, evenings, social engagements, and holidays ranting about the things that really get on my nerves.  Today, July 4th, a day commemorating the birth of our glorious nation, I spent the early afternoon orating on the relative merits of the LMS in hopes of fomenting revolution. ...
  • I Studied Medieval History Because I Thought it was the Metal Thing to Do
    Jun 24, 2009
    Yes, that's true.  I even got a Master's Degree.  Now, I like history and other humanities for lots of reasons, not just because they're sometimes kind of metal, but I figured that with my first post on this site I'd return to my roots and original reasons for liking history. ...