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
This are really good hacks! Shure I’ll use some of them in my buddypress installation. Thanks, great article!
thanks for the mention again :-)
also note for BP 1.2.3 that you can filter `bp_core_signup_send_activation_key` to false to disable the email as well (otherwise that may confuse new sign ups)
when using hack number 2 i get an error with this line:
return > false;
anybody else who have this? is there an error in the code?
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.
when i removed the : > in this line it wordked:
return > false;
It should be:
function fix_signup_form_validation_text() {
return false;
}
The “>” is a syntax error.
Wow Sarah! #3 makes it easy for bp site members to spread the link love. Thanks for the tips.
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.
You might try this plugin to restrict group creation: http://wordpress.org/extend/plugins/buddypress-restrict-group-creation/
That’s great! Thanks a lot!
Sarah,
I like the code to disable the email activation requirement, but looking at the code, that seems like it will only work with a regular WP. Have you tested it with WPMU?
John Lynn – You’re right – I think it only works with regular WP, but you might try installing this plugin: http://www.thinkinginwordpress.com/2009/10/autoactivate-users-and-blogs-at-buddypress-signup/
I’m using that on a WPMU 2.9.2 site with BP 1.2.3 and it works.
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
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?
John Lynn – No, I just edited the email so that it doesn’t send the activation code but instead sends a welcome email.
Where did you edit the email? Did you do that in the core somewhere?
Yeah it’s a core hack but I don’t remember how I did it. Will look and try to let you know.
John Lynn -
Check out this over here and see if it works for you:
http://www.nossmedia.com/uncategorized/want-to-remove-the-notification-email-from-buddypress-heres-how/
Let me know!
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.
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.
these are good tips for buddypress. Thanks for the hacks, I gonna use it too!
Thank you very much. I just got what i needed.
Thank you for those hacks, just to say, instead of write all those hacks in wp_config.php, you should prefer to put them in /wp-content/plugins/bp-custom.php
That’s much better in case you upgrade your WordPress system.
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
Very very very very nice!!!
Thanks!
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 :)
Very much useful buddypress tutorials thanks for sharing this with us
I cant get number six to work. I pated it in bottom of functions.php. Any advice?
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
Ever wonder how you can delete or manually add a Buddypress activity on to your network? Here’s how: http://customwebdesignseo.com/groups/buddypress/
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. :-/