Back to Course

How to Build an Online Community on Your Site

0% Complete
0/46 Steps
  1. Introduction
    Introduction to this course
  2. Creating a ready to use site on LaunchMyWp
    1 Topic
  3. Installing Required WordPress Plugins (BuddyPress)
    4 Topics
  4. Setting Up and Configuring BuddyPress and Content
    15 Topics
  5. Installing and Configuring BuddyBuilder
    4 Topics
  6. Customizations
    1 Topic
  7. FAQ
    13 Topics
  8. Conclusion
Lesson 6, Topic 1
In Progress

Customization Snippets

John March 15, 2021
Lesson Progress
0% Complete

You can customize various aspects in BuddyPress. PHP code snippets can be added to the functions.php file of your child theme. Alternatively, you can use the code snippets plugin to add the custom codes.

Some of these snippets include:

1. How to change members per page in BuddyPress members directory

function members_per_page( $retval ) {
    $retval['per_page'] = 12;

    return $retval;
add_filter( 'bp_after_has_members_parse_args', 'members_per_page' );

2. How to remove the groups tab from users profiles

function remove_groups(){
add_action('bp_groups_setup_nav', 'remove_groups');

3. How to remove the “Send Private Message” button from users who are not friends of the member whose profile they are viewing

add_filter( 'bp_get_send_message_button', function( $array ) {
    if ( friends_check_friendship( bp_loggedin_user_id(), bp_displayed_user_id() ) ) {
        return $array;
    } else {
        return '';
} );

The BuddyPress forum also offers many more code snippets and solutions from the community to help you add that extra functionality that you need.