bbPress 2.0 (plugin) – Adding User Role to Replies

In bbPress 2.0, the recent plugin version, that comes packed with the twentyten bbPress theme, I noticed that a role was not being displayed within the topic reply template.

I ended up adapting the core design from twentyten to WooThemes Canvas and felt the forum role was an essential aspect that was missing.

I came up with a quick solution but perhaps you can contribute a more dynamic solution for removing the bbp_ prefix that is included when simply displaying a bbPress Role.

Here is what I came up with:

roles ) && is_array( $user->roles ) ) {
foreach ( $user->roles as $role )
if ( $role == bbp_moderator ) {
echo 'Moderator';
} elseif ( $role == bbp_participant ) {
echo 'Participant';
} else {
echo $role;


Useful WordPress Template Updates

A continual collection of WordPress template and code changes that I find useful when designing and developing WordPress blogs.

Body Class Reference

Especially when developing a number of custom elements on specific pages of your site you will want to be able to call that specific page or body class using the following update to the header.php file




<body <?php body_class( $class ); ?>>

Styling Your WordPress Page List

In customizing WordPress navigation bards I have found it increasingly important to continue to add addition html into such WordPress functions as a simple page list. As as example I sought to add a <span> before and after each link in a standard page list.

I have come across two solid solutions. One being a custom page list:

  <?php $list = wp_list_pages('echo=0&title_li=');
  $list = str_replace('<a ','<span><a ',$list);
  $list = str_replace('</a> ','</a></span>',$list);
  echo $list; ?>

However the second solution is a simple update to the wordpress page list that is already commonly used throughout wordpress template files:

<?php wp_list_pages('title_li=&depth=1&link_before=<span>&link_after=</span>'); ?>

You may want to also include the additional sort order function when adding the page list to your blog's setup:

<?php wp_list_pages('sort_column=menu_order&title_li=&depth=1&link_before=<span>&link_after=</span>'); ?>