6 BuddyPress Power Hacks You Don’t Want to Miss
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.
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.
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:
/* 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:
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
FREE EBOOK
Your step-by-step roadmap to a profitable web dev business. From landing more clients to scaling like crazy.
FREE EBOOK
Plan, build, and launch your next WP site without a hitch. Our checklist makes the process easy and repeatable.
3. Put BuddyPress Profiles in the Root – ie. http://example.org/username/
Add this line to your wp-config.php file:
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:
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:
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:
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