### Install Dependencies and Start Development Environment Source: https://github.com/buddypress/buddypress/blob/master/README.md Installs project dependencies and starts the local development environment. Ensure Docker is running before executing these commands. ```bash npm install npm run wp-env start ``` -------------------------------- ### Install Node.js Modules Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Install the Node.js modules required for BuddyPress development. This command may take some time to complete. ```bash npm install ``` -------------------------------- ### Navigate to BuddyPress Directory Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Change the current directory to the BuddyPress plugins folder. This is the first step before installing dependencies. ```bash cd ~/Plugins/buddypress ``` -------------------------------- ### Run PHP Unit Tests (Standard) Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Execute the PHP unit tests for a standard WordPress configuration. Ensure Composer packages are installed first. ```bash npm run test-php ``` -------------------------------- ### Install Composer Packages for PHP Unit Tests Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Install Composer packages necessary for running PHP unit tests. This step is optional and only required if you plan to run tests. ```bash composer install ``` -------------------------------- ### Example cURL Request for Activity Embed Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/activity/embeds.md Demonstrates how to use cURL to request an activity embed from the BuddyPress oEmbed endpoint. Replace example.com and the activity URL with your specific details. ```bash curl "https://example.com/wp-json/oembed/1.0/embed/activity?url=https://example.com/members/user/activity/123" ``` -------------------------------- ### Run PHP Unit Tests (Multisite) Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Execute the PHP unit tests for a Multisite WordPress configuration. Ensure Composer packages are installed first. ```bash npm run test-php-multisite ``` -------------------------------- ### Override Local Environment Configuration Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Example of overriding default local development environment settings using a `.wp-env.override.json` file. This example includes a specific WordPress core version and an additional plugin. ```json { "core": "WordPress/WordPress#master", "plugins": [ ".", "buddypress/bp-classic#trunk" ], "config": { "WP_DEBUG": true, "SCRIPT_DEBUG": true } } ``` -------------------------------- ### Setting Up BuddyPress Component Globals Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Configure essential BuddyPress globals for a custom component, including its root slug, directory status, and rewrite IDs. This setup is crucial for BuddyPress to recognize and manage your component's directory. ```php $bp_globals = array( // This what comes after your `site_url()`. 'root_slug' => 'custom-component', // I confirm my component has a directory area. 'has_directory' => true, /* * This is new in BuddyPress 12.0.0: the BP Rewrites API globals. * * If you specify the following 4 keys, BuddyPress will build the corresponding * WordPress rewrite rules for you. */ 'rewrite_ids' => array( 'directory' => 'custom_directory', 'single_item' => 'custom_item', 'single_item_action' => 'custom_item_action', 'single_item_action_variables' => 'custom_item_action_variables', ), 'directory_title' => __( 'Custom Directory', 'custom-text-domain' ), 'search_string' => __( 'Search custom items', 'custom-text-domain' ), ); ``` -------------------------------- ### BuddyPress Group Extension Display Method Example Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/groups/extension.md Implement the `display()` method to output content for a group extension tab. It accepts the group ID and should echo the desired HTML markup. ```php if ( bp_is_active( 'groups' ) ) { class BP_Custom_AddOn_Group_Extension extends BP_Group_Extension { public function __construct() { /* Your group extension's constructor. */ } /** * Outputs the content of your group extension tab. * * @param int|null $group_id ID of the displayed group. */ public function display( $group_id = null ) { // You need to echo the markup. printf( '
%1$s %2$s
', esc_html__( 'It works! The displayed group ID is', 'custom-text-domain' ), $group_id ); } } } ``` -------------------------------- ### Send REST API Request with Nonce in JavaScript Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/execution-contexts/rest-api/README.md Demonstrates how to send a GET request to the BuddyPress REST API using the Fetch API, including the 'X-WP-Nonce' header for authentication. Ensure the nonce is correctly passed from your PHP script. ```javascript // Set headers. const requestHeaders = new Headers( { 'X-WP-Nonce': bpRestApi.nonce, 'Content-Type': 'application/json', } ); // Send & handle the request. fetch( '/wp-json/buddypress/v2/components', { method: 'GET', headers: requestHeaders, } ).then( ( response ) => { return response.json(); } ).then( ( data ) => { console.log( data ); } ); ``` -------------------------------- ### Initialize Custom Component with BP_Component::start() Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Set up your component's core properties, including its ID, name, path for additional files, and optional parameters like admin bar order and features, within the constructor using `parent::start()`. ```php class BP_Custom_Component extends BP_Component { /** * Your component's constructor. */ public function __construct() { parent::start( // Your component ID. 'custom', // The raw name for your component. Do not use translatable strings here. 'Custom component', /* * The path from where additional files should be included. * * FYI: this class is inside an `/inc` subdirectory of your add-on directory. * * Below is a typical relative path for it: * `/wp-content/plugins/bp-custom/inc/classes/class-bp-custom-component.php */ plugin_dir_path( dirname( __FILE__ ) ), // Additional parameters. array( 'adminbar_myaccount_order' => 100, 'features' => array( 'feature-one', 'feature-two' ), 'search_query_arg' => 'custom-component-search', ) ); } } ``` -------------------------------- ### Switch to Trunk for Beta/RC1 Releases Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/project/release/build-checklist.md Use this command to switch your local repository to the trunk for beta releases or the first release candidate. Ensure you are in the correct directory before executing. ```bash svn switch https://buddypress.svn.wordpress.org/trunk/ ``` -------------------------------- ### Create BuddyPress Directory Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Use this command to create a new directory for BuddyPress development. ```bash mkdir ~/Plugins/buddypress ``` -------------------------------- ### Members Directory Permalink Functions Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Functions to get and echo the permalink for the Members directory. Includes filter hooks for customization. ```APIDOC ## `bp_get_members_directory_permalink()` & `bp_members_directory_permalink()` ### Description Retrieves or echoes the permalink for the BuddyPress Members directory. `bp_get_members_directory_permalink()` returns the URL, allowing for filtering via `bp_get_members_directory_permalink`. `bp_members_directory_permalink()` echoes the escaped URL. ### Method - `bp_get_members_directory_permalink()`: Returns URL string. - `bp_members_directory_permalink()`: Echoes URL string. ### Filter Hook - `bp_get_members_directory_permalink`: Allows modification of the Members directory URL. ``` -------------------------------- ### Download BuddyPress using Git (Patches) Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Clone the BuddyPress development version using Git, suitable for contributing via patches. ```bash # Git using patches git clone git://buddypress.git.wordpress.org/ ~/Plugins/buddypress ``` -------------------------------- ### Get Activity Items Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/execution-contexts/rest-api/activity.md Retrieves a collection of activity items based on specified parameters. Supports filtering, sorting, and pagination. ```APIDOC ## GET /buddypress/v2/activity ### Description Retrieves a collection of activity items. ### Method GET ### Endpoint /buddypress/v2/activity ### Parameters #### Query Parameters - **context** (string) - Optional - Scope under which the request is made; determines fields present in response. One of: `view`, `embed`, `edit`. Default: `view`. - **page** (integer) - Optional - Current page of the collection. Default: `1`. - **per_page** (integer) - Optional - Maximum number of activity items to be returned in result set. Default: `10`. - **search** (string) - Optional - Limit results to those matching a string. - **exclude** (array) - Optional - Ensure result set excludes specific IDs. Default: `[]`. - **include** (array) - Optional - Ensure result set includes specific IDs. Default: `[]`. - **order** (string) - Optional - Order sort attribute ascending or descending. One of: `desc`, `asc`. Default: `desc`. - **after** (string) - Optional - Limit result set to activity items published after a given ISO8601 compliant date, format: `date-time`. - **user_id** (integer) - Optional - Limit result set to activity items created by a specific user (ID). Default: `0`. - **status** (string) - Optional - Limit result set to activity items with a specific status. One of: `ham_only`, `spam_only`, `all`. Default: `ham_only`. - **scope** (string) - Optional - Limit result set to activity items with a specific scope. One of: `just-me`, `friends`, `groups`, `favorites`, `mentions`. - **group_id** (integer) - Optional - Limit result set to activity items created by a specific group. Default: `0`. - **site_id** (integer) - Optional - Limit result set to activity items created by a specific site. Default: `0`. - **primary_id** (integer) - Optional - Limit result set to activity items with a specific prime association ID. Default: `0`. - **secondary_id** (integer) - Optional - Limit result set to activity items with a specific secondary association ID. Default: `0`. - **component** (string) - Optional - Limit result set to activity items with a specific BuddyPress component. One of: the active BuddyPress component names. - **type** (array) - Optional - Limit result set to activity items with one or more specific activity type. One of: the registered activity types. - **display_comments** (string) - Optional - Controls how comments are displayed. One of: `''` (no comments), `stream` (within stream), `threaded` (below each activity item). Default: `''`. ### Response #### Success Response (200) - An array of objects representing the matching activity items on success. #### Response Example (Example not provided in source) ### Request Example ```javascript fetch( '/wp-json/buddypress/v2/activity?context=view&type=activity_update', { method: 'GET', headers: requestHeaders, } ).then( ( response ) => { return response.json(); } ).then( ( data ) => { console.table( data ); } ); ``` ``` -------------------------------- ### Get Groups Directory URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md This function returns the URL for the Groups directory. It utilizes bp_rewrites_get_url() and exposes a filter hook for overriding the URL. ```php // Example usage with path chunks to specify a group type directory. $groups_directory_url = bp_get_groups_directory_url( array( 'directory_type' => 'public' ) ); ``` -------------------------------- ### Create Tag from Trunk for Beta/RC1 Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/project/release/build-checklist.md This command creates a tag from the trunk for beta or the first release candidate. Replace '12.0.0-beta1' or '12.0.0-RC1' with the specific version tag. ```bash svn cp https://buddypress.svn.wordpress.org/trunk https://buddypress.svn.wordpress.org/tags/12.0.0-beta1 ``` -------------------------------- ### Get Group Create URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Retrieve the URL for the group creation context. This function can accept an array of action variables to append to the URL. ```php // Returned URL is like https://site.url/groups/create/step/group-details/. $create_url = bp_groups_get_create_url( array( 'group-details' ) ); ``` -------------------------------- ### Signup Page Permalink Functions Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Functions to get and echo the permalink for the user registration page. Includes a filter hook for URL modification. ```APIDOC ## `bp_get_signup_page()` & `bp_signup_page()` ### Description Retrieves or echoes the permalink for the BuddyPress registration form. `bp_get_signup_page()` returns the URL, which can be filtered using `bp_get_signup_page`. `bp_signup_page()` echoes the escaped URL. ### Filter Hook - `bp_get_signup_page`: Allows modification of the signup page URL. ``` -------------------------------- ### Download BuddyPress using Git (Pull Requests) Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Clone your forked BuddyPress repository from GitHub to contribute via pull requests. ```bash # Git using Pull Requests git clone https://github.com/imath/buddypress.git ~/Plugins/buddypress ``` -------------------------------- ### Register a Custom BuddyPress Component Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Register your custom component by hooking into the `bp_setup_components` action. This ensures your component is initialized after required components. ```php function register_custom_component() { /* * BP_Custom_Component is the class of your component. * You'll discover in the rest of this documentation resource how you * can build this class. */ buddypress()->custom = new BP_Custom_Component(); } add_action( 'bp_setup_components', 'register_custom_component' ); ``` -------------------------------- ### Account Activation Page Permalink Functions Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Functions to get and echo the permalink for the account activation form. Includes a filter hook for URL modification. ```APIDOC ## `bp_get_activation_page()` & `bp_activation_page()` ### Description Retrieves or echoes the permalink for the BuddyPress account activation form. `bp_get_activation_page()` returns the URL, which can be filtered using `bp_get_activation_page`. `bp_activation_page()` echoes the escaped URL. ### Filter Hook - `bp_get_activation_page`: Allows modification of the account activation page URL. ``` -------------------------------- ### Member Type Directory Permalink Functions Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Functions to get and echo the permalink for a specific member type's directory. Supports filtering for customization. ```APIDOC ## `bp_get_member_type_directory_permalink()` & `bp_member_type_directory_permalink()` ### Description Retrieves or echoes the permalink for a directory listing of users with a specific member type. `bp_get_member_type_directory_permalink()` returns the URL, which can be filtered using `bp_get_member_type_directory_permalink`. `bp_member_type_directory_permalink()` echoes the escaped URL. ### Arguments - `$member_type` (string, Optional): The ID of the member type. Defaults to the globally set current member type if not provided. ### Filter Hook - `bp_get_member_type_directory_permalink`: Allows modification of the member type directory URL. The member type object is available as the second argument to this filter. ``` -------------------------------- ### Define Component Globals with setup_globals() Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Implement the `setup_globals()` method to define BuddyPress-specific or custom global variables for your component. Remember to call `parent::setup_globals()` to ensure proper integration. ```php class BP_Custom_Component extends BP_Component { /** * A custom global for your component only. * * @var boolean */ public $custom_global = false; public function __construct() { /** Your component's constructor code. */ } /** * Setup BP Specific globals and custom ones. * * @since BuddyPress 1.5.0 * * @param array $bp_globals { * All values are optional. * @type string $slug The portion of URL to use for a member's page about your component. * Default: the component's ID. * @type string $root_slug The portion of URL to use for your component's directory page. * @type boolean $has_directory Whether your component is using a directory page or not. * @type array $rewrite_ids Your components rewrite IDs. * @type string $directory_title The title of your component's directory page. * @type string $search_string The placeholder text in the component directory search box. * Eg: 'Search Custom objects...'. * @type callable $notification_callback The callable function that formats the component's notifications. * @type array $global_tables An array of database table names. * @type array $meta_tables An array of metadata table names. * @type array $block_globals An array of globalized data for your component's Blocks. * } */ public function setup_globals( $bp_globals = array() ) { $bp_globals = array( 'slug' => 'custom-slug', 'has_directory' => false, ); // BP Specific globals. parent::setup_globals( $bp_globals ); // Your component's globals (if needed). $this->custom_global = true; } } ``` -------------------------------- ### Download BuddyPress using SVN Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md This command is used to download the BuddyPress development version via Subversion. ```bash # SVN svn co https://buddypress.svn.wordpress.org/trunk/ ~/Plugins/buddypress ``` -------------------------------- ### Get BuddyPress Directory URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Use this function to construct BuddyPress directory URLs. It accepts an associative array of arguments to define the URL structure. ```php echo bp_rewrites_get_url( array( 'component_id' => 'members', ) ); ``` -------------------------------- ### Branch from Trunk for First RC Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/project/release/build-checklist.md After creating the tag for the first release candidate, branch from the trunk to create the corresponding release branch. Replace '12.0' with the relevant major version. ```bash svn cp https://buddypress.svn.wordpress.org/trunk/ https://buddypress.svn.wordpress.org/branches/12.0 ``` -------------------------------- ### Get Group Type Directory Permalink Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Retrieve the permalink for a directory listing of groups of a specific type. This function uses bp_get_groups_directory_url() and offers a filter hook for customization. ```php // Example: Get the permalink for a directory of 'public' groups. $permalink = bp_get_group_type_directory_permalink( 'public' ); ``` -------------------------------- ### Add Custom Hook in BuddyPress Source: https://github.com/buddypress/buddypress/blob/master/docs/user/advanced/functionalities.md Example of adding a custom action hook to display a message before the members list. This demonstrates how to integrate custom PHP functions with BuddyPress actions. ```php function say_hi_just_before_the_members_list() { printf( '%s
', esc_html__( 'Howdy Buddy!' ) ); } add_action( 'bp_before_directory_members_page', 'say_hi_just_before_the_members_list' ); ``` -------------------------------- ### Initialize a Group Extension with Arguments Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/groups/extension.md Initializes a group extension within its constructor using `parent::init()`. This sets up the extension's slug, name, navigation position, and access control. ```php if ( bp_is_active( 'groups' ) ) { /** * BP Custom group extension Class. */ class BP_Custom_AddOn_Group_Extension extends BP_Group_Extension { /** * Your group extension's constructor. */ public function __construct() { $args = array( 'slug' => 'custom-group-extension', 'name' => __( 'Custom group extension', 'custom-text-domain' ), 'nav_item_position' => 105, 'access' => 'anyone', 'show_tab' => 'anyone', ); parent::init( $args ); } /** * Outputs the content of your group extension tab. * * @param int|null ID of the displayed group. */ public function display( $group_id = null ) { printf( '%1$s %2$s
', esc_html__( 'It works! The displayed group ID is', 'custom-text-domain' ), $group_id ); } } } ``` -------------------------------- ### Generate Custom Member URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Use `bp_rewrites_get_url` with component and item arguments to construct a customized URL. This example shows how to generate a URL for a specific member's activity page. ```php // Init a single member's URL. $args = array( 'component_id' => 'members', // The BP Members component ID. 'single_item' => 'imath', // The user slug (stored in $wpdb->users.user_nicename). ); // Get the customized part of the URL. $args['single_item_component'] = bp_rewrites_get_slug( 'members', // The BP Members component ID. 'member_activity', // The screen rewrite ID. 'activity' // The sub page default slug. ); // Outputs the customized URL for the Activity page of the member echo bp_rewrites_get_url( $args ); ``` -------------------------------- ### Checkout BuddyPress Repository from WordPress.org Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/project/release/build-checklist.md Use SVN to checkout the entire BuddyPress repository from WordPress.org to a local directory. This allows for easy navigation of the repository structure and modification of files. ```bash mkdir buddypress-wporg-repo cd buddypress-wporg-repo svn co https://plugins.svn.wordpress.org/buddypress/ . --ignore-externals ``` -------------------------------- ### oEmbed REST API Endpoint Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/activity/embeds.md The BuddyPress oEmbed endpoint allows you to fetch and display embedded activity items. You can use this endpoint to get embeddable HTML for a specific activity item. ```APIDOC ## GET /wp-json/oembed/1.0/embed/activity ### Description Fetches an embeddable representation of a BuddyPress activity item. ### Method GET ### Endpoint /wp-json/oembed/1.0/embed/activity ### Parameters #### Query Parameters - **url** (string) - Required - The permalink of the activity item. - **format** (string) - Optional - The format of the embed (default: json). - **maxwidth** (integer) - Optional - The maximum width of the embed. - **hide_media** (boolean) - Optional - Set to `true` to hide media from the embed. ### Request Example ```bash curl "https://example.com/wp-json/oembed/1.0/embed/activity?url=https://example.com/members/user/activity/123" ``` ### Response #### Success Response (200) - **html** (string) - The HTML embed code for the activity item. - **type** (string) - The type of embed (e.g., 'rich'). - **version** (string) - The oEmbed version. - **title** (string) - The title of the activity item. - **provider_name** (string) - The name of the provider (BuddyPress). - **provider_url** (string) - The URL of the provider. - **width** (integer) - The width of the embed. - **height** (integer) - The height of the embed. ``` -------------------------------- ### Set Custom Directory Template and Content Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Configures the BuddyPress theme compatibility for a custom directory, including setting a dummy post and defining the content output. This function should be hooked into 'bp_screens'. ```php /** * Sets the template to load for the Custom directory. */ function bp_custom_add_on_directory_screen() { if ( ! bp_is_current_component( 'custom' ) || bp_is_user() ) { return; } bp_update_is_directory( true, 'custom' ); // This is where you should use a custom template extending BP Templates stacks. bp_core_load_template( 'custom/index' ); } add_action( 'bp_screens', 'bp_custom_add_on_directory_screen' ); /** * Sets the Custom Add-on directory content dummy post. */ function bp_custom_add_on_set_dummy_post() { // Use the Custom Add-on directory title by default. $title = bp_get_directory_title( 'custom' ); bp_theme_compat_reset_post( array( 'ID' => 0, 'post_title' => $title, 'post_author' => 0, 'post_date' => 0, 'post_content' => '', 'post_type' => 'page', 'post_status' => 'publish', 'is_page' => true, 'comment_status' => 'closed', ) ); } /** * Outputs the Custom directory content. */ function bp_custom_add_on_set_content_template() { /* * You should use a specific template extending the BP Templates stack. * eg: /path-to-your-add-on-templates/custom/index.php`. * * Then you'd need to buffer the template content doing: * $template = bp_buffer_template_part( 'custom/index', null, false ); * * This would let themes/template packs override your template if they need more * customization. */ $template = sprintf( '%s
', esc_html__( 'It works!', 'custom-text-domain' ) ); if ( bp_current_item() ) { $template .= sprintf( '%1$s %2$s
', esc_html__( 'Current item is:', 'custom-text-domain' ), esc_html( bp_current_item() ) ); } if ( bp_current_action() ) { $template .= sprintf( '%1$s %2$s
', esc_html__( 'Current item action is:', 'custom-text-domain' ), esc_html( bp_current_action() ) ); } if ( bp_action_variables() ) { $template .= sprintf( '%1$s %2$s
', esc_html__( 'Current item action variables are:', 'custom-text-domain' ), implode( ', ', array_map( 'esc_html', bp_action_variables() ) ) ); } return $template; } /** * Sets the Custom Add-on directory theme compat screens. */ function bp_custom_add_on_set_directory_theme_compat() { if ( bp_is_current_component( 'custom' ) && ! bp_is_user() ) { add_action( 'bp_template_include_reset_dummy_post_data', 'bp_custom_add_on_set_dummy_post' ); add_filter( 'bp_replace_the_content', 'bp_custom_add_on_set_content_template' ); } } add_action( 'bp_setup_theme_compat', 'bp_custom_add_on_set_directory_theme_compat' ); ``` -------------------------------- ### Get Group Manage URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Use this function to retrieve the URL for a group's management section. It accepts a group ID, slug, or object, and optional path chunks for specific actions. ```php $group_id = 12; // Returned URL is like https://site.url/groups/group_slug/admin/manage-members/. $user_url = bp_get_group_manage_url( $group_id, bp_groups_get_path_chunks( array( 'manage-members' ), 'manage' ) ); ``` -------------------------------- ### Get a Single Group's Admin URL Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/functions/rewrites.md Retrieve the front-end admin URL for a group using `bp_get_group_manage_url()`. This function is filterable via the `bp_get_group_manage_url` hook and requires a group object and path chunks. ```php // Example usage for bp_get_group_manage_url() would go here, // but is not provided in the source text. ``` -------------------------------- ### Register a Theme Compat Feature Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/theme-compat/features.md Register a new theme compatibility feature for a specific template pack. This should be done within an 'bp_after_setup_theme' hook callback. ```php function set_my_template_pack_features() { $template_pack_id = 'my-template-pack-id'; $feature_args = array( 'name' => 'my_theme_compat_feature', 'settings' => array( 'components' => array( 'groups', 'members' ), ), ); // Registers the Theme Compat feature into your template pack. bp_set_theme_compat_feature( $template_pack_id, $feature_args ); } add_action( 'bp_after_setup_theme', 'set_my_template_pack_features' ); ``` -------------------------------- ### Synchronize Local BuddyPress Copy Source: https://github.com/buddypress/buddypress/blob/master/docs/contributor/code/README.md Use these commands to synchronize your local copy of BuddyPress with the central repository, depending on your version control system. ```bash # SVN svn up ``` ```bash # Git using patches git pull origin master ``` -------------------------------- ### Start New Message Thread or Reply Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/execution-contexts/rest-api/messages.md Use this endpoint to initiate a new private message thread or add a reply to an existing one. Ensure the `requestHeaders` are correctly configured for WordPress REST API authentication. ```javascript fetch( '/wp-json/buddypress/v2/messages', { method: 'POST', headers: requestHeaders, body: JSON.stringify( { message: 'bapuu is the BuddyPress wapuu', recipients: [ 2, 3 ], } ), } ).then( ( response ) => { return response.json(); } ).then( ( data ) => { console.log( data ); } ); ``` -------------------------------- ### Include Component Files with includes() Source: https://github.com/buddypress/buddypress/blob/master/docs/developer/components/build-component.md Use the `includes()` method to specify and load necessary PHP files for your component. Call `parent::includes()` with an array of filenames relative to your component's path. ```php class BP_Custom_AddOn_Component extends BP_Component { public function __construct() { /** Your component's constructor code. */ } public function setup_globals( $bp_globals = array() ) { /** Your component's code to set custom/BP globals. */ } /** * Include your component's required files. * * @since BuddyPress 1.5.0 * * @param array $files An array of file names located into `$this->path`. * NB: `$this->path` in this example is `/wp-content/plugins/bp-custom/inc` */ public function includes( $files = array() ) { parent::includes( array( 'functions.php', ) ); } } ```