6 BuddyPress Power Hacks You Don’t Want to Miss

On a recent trip to the BuddyPress forums, I found a few useful hacks that may in fact be options that you’ve been wishing for. Every BuddyPress site has unique needs and the default setup may not be suitable for your community’s interaction. No need to wait until someone makes a plugin for you – just drop a little hack in and get it done yourself. I’ve tested all of these hacks with WP 2.9.2 and BP 1.2.2.1. The ones I’ve selected are those that I think will be the most useful to the greatest number of people. Happy Hacking!

1. Display Username in Member Directory Instead of Default Member Name

Add this to your theme’s functions.php:

1
2
3
4
5
6
7
/* Display Username in Directory */
function my_member_username() {
    global $members_template;

    return $members_template->member->user_login;
}
add_filter('bp_member_name','my_member_username');

Source: r-a-y at BuddyPress.org Forums

2. Disable Required User Activation

This may be a built-in option to enable or disable the required activation for user accounts in future releases of BuddyPress. For now, just add this quick hack as a plugin or in your theme’s functions.php file:

1
2
3
4
5
6
7
8
9
10
11
function disable_validation( $user_id ) {
  global $wpdb;

  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->users SET user_status = 0 WHERE ID = %d", $user_id ) );
}
add_action( 'bp_core_signup_user', 'disable_validation' );

function fix_signup_form_validation_text() {
  return false;
}
add_filter( 'bp_registration_needs_activation', 'fix_signup_form_validation_text' );

Source: Andy Peatling at BuddyPress.org Forums

3. Put BuddyPress Profiles in the Root – ie. http://example.org/username/

Add this line to your wp-config.php file:

1
define ( 'BP_ENABLE_ROOT_PROFILES', true );

Source: BuddyPress.org: Changing Internal Configuration Settings

4. Change the default tab opened when looking at a user’s profile (default is activity):

Add this line to your wp-config.php file:

1
define( 'BP_DEFAULT_COMPONENT', 'profile' );

Source: BuddyPress.org: Changing Internal Configuration Settings

5. Disable the BuddyPress Admin Bar at the top of every screen

Add this line to your wp-config.php file:

1
define ( 'BP_DISABLE_ADMIN_BAR', true );

Source: BuddyPress.org: Changing Internal Configuration Settings

6. Add a View BuddyPress profile link in Dashboard >> Users

Add this to your theme’s functions.php file:

1
2
3
4
5
6
function user_row_actions_bp_view($actions, $user_object) {
global $bp;
$actions['view'] = '<a href="' . bp_core_get_user_domain($user_object->ID) . '">' . __('View BP') . '</a>';
return $actions;
}
add_filter('user_row_actions', 'user_row_actions_bp_view', 10, 2);

Source: Rich Fuller – Tutorial

Comments (36)

  1. I didn’t get any errors when I used it. Sometimes when you paste from the blog to your code it can mess up the way the single tick quotes display ‘ You don’t want curly quotes, if that helps. Also, depends on where you pasted it in your function file.

  2. Thanks a lot for this helpful hacks!

    Maybe you can tell me how to modify the BuddyPress groups so that only an administrator can create groups?
    I would like to build up a network with just a few groups with group forums.

  3. I’ll check it out. I’d seen this plugin before, but it said that it wasn’t currently working at the top. Since you say it is with the latest, I’ll give it a whirl. If nothing else, I’ll check the code and see if I can’t build on top of it. Maybe integrate it to work with either WPMU and WP

  4. Ok, I just tried it and it seems to be working for me. I have the same versions as you. However, it’s still sending the activation email. Did you find a way to stop the activation email from sending?

  5. Thanks Sarah. That’s gets me closer and helped me find it. Although, that link seems to stop the blog email notification and not the user notification. Plus, I’m hoping to do it with a plugin instead of changing the core. I know it’s possible, because there’s this premium plugin: http://buddydev.com/plugins/buddypress-premium-plugins/plugin-bp-auto-activate-auto-login-redirect-to-profile-automatically-activate-your-new-user-signuplog-them-in-and-redirect-to-their-buddypress-profile-on-signup/ I just prefer to not pay for premium plugins if possible. Plus, the code is so close to working.

    I’m guessing on the plugin you’re using, it’s trying to disable the email notification, but there’s something wrong with the order that it’s removing it or something.

  6. Sarah,

    This must one of hte most useful tips posts for buddypress i’ve ever run into, thank you. It answered 4 questions for me :)

    John Lynn,

    I use this plugin:
    http://byotos.com/plugins/welcome-pack/

    In addition to its cool features, It allows you to edit system generated emails, so you can do like Sarah and remove the activation variable from the “signup validation” email and make it a welcome email instead.

    Cheers.

  7. Sarah,

    These are awesome hacks and really answer some of things we’ve been trying to do for the user profiles on our site. However, we run on the Genesis theme, which uses a different format for their functions.php. Do you have any advice for how I would transfer some of this over to fit within their parameters?

    Thank you,
    Shane

  8. I am using xProfiles ACL for my BuddyPress site. I have a base field group and a few other field groups. The base field group should be visible to all ‘subscribers’. The rest of the field groups should only be visible by one particular role. So, i set it up accordingly.

    What I think is a bit strange, is that the user isn’t able to edit his own details in field groups other than ‘Base’.

    I know it is because default user role to my site is ‘Subscriber’, but i think it should be enabled for a user to always be able to edit his own profile details.

    can anybody help me out on this? I will be grateful. Thank you :)

  9. Hi,

    Is it all possible to change the role types that appear in the member directory. Say for example if I only wanted those that were at Contributer Level shown and those at subscriber level hidden?

    David

  10. I’ve found that number 2 – the define for members placed in the root, doesn’t work for me. It strangely does a search for members with the same name when I select a profile name online. :-/

Participate