从插件发布活动

从插件发布活动

Codex Home → BuddyPress Plugin Development → Posting Activity from Plugins
Posting Activity from Plugins

bp_activity_add()
This function was introduced in BuddyPress 1.1, it』s located in /bp-activity/bp-activity-functions.php at line 997 (version 1.7-beta1). It needs an array of arguments and returns the activity id once created by the method BP_Activity_Activity::save()
BuddyPress uses some aliases to call this function from its different components as detailed in this chart :

Functions
Components
Types
@uses

bp_activity_post_update()
activity
activity_update
bp_activity_add()

bp_activity_new_comment()
activity
activity_comment

bp_xprofile_new_avatar_activity()
xprofile
new_avatar

bp_core_new_user_activity
xprofile
new_member

friends_record_activity()
friends
friendship_accepted
friendship_created

groups_record_activity()
groups
created_group
joined_group
new_forum_topic
new_forum_post

bp_blogs_record_activity()
blogs
new_blog
new_blog_post
new_blog_comment

In the following chart, the array of arguments the function bp_activity_add() needs is detailled :

Arguments
Default value
Explanation

id
false
If an id is passed, then the activity will be updated with the value of other arguments

action

The activity action – e.g. 「Jon Doe posted an update」

content

The content of the activity item e.g. 「BuddyPress is awesome guys!」

component
false
The identifier of the component (groups, activity, blogs, xprofile)

type
false
The activity type e.g. activity_update, joined_group, new_member…

primary_link

The primary URL for this item

user_id
bp_loggedin_user_id()
The user to record the activity for.

item_id
false
The id of the specific item being recorded, e.g. a group_id

secondary_item_id
false
A second id used to further filter e.g. a topic_id

recorded_time
bp_core_current_time()
The GMT time that this activity was recorded

hide_sitewide
false
If true, the activity will be hidden from the sitewide activity

is_spam
false
Is this activity item to be marked as spam?

The hide_sitewide argument is responsible for the visibility of the activity. If set to true, the activity won』t show in the sitewide activities (Activity Directory).
It means the activity will be 「private」 and only visible for the logged in user when viewing his profile activities (if the argument user_id is the logged in user id) and for the displayed hidden or private group when viewing its activity page (if the component argument is 『groups』 and the argument 『item_id』 is the one of the group displayed.
Hooking Activities in plugins.
If the Activity component is active ( bp_is_active( 『activity』 ) ), it can be interesting to hook the bp_activity_add function to fire some actions just after the activity has been recorded. It informs us about what just happened. For instance, we could automate a mail to inform the community admin of the creation of new groups :
function bp_plugin_hook_activity_add( $args ) {

// sends an email to admin to inform him of a group creation
if( $args['type'] == 'created_group' )
wp_mail( get_option( 'admin_email' ), 'New group!', $args['action'], 'Content-Type: text/html' );

}

add_action( 'bp_activity_add', 'bp_plugin_hook_activity_add', 10, 1 );

The advantage in this case is that we take benefit of the action argument to get some useful information such as the group creator and the permalink to the group. Of course, if the Activity component is not active, then we need to hook 『groups_group_create_complete』 and build a mail thanks to the group_id that this hook comes with.
In the Activity component, the 2 aliases ( bp_activity_post_update & bp_activity_new_comment ) have their own hooks, so we can rely on them to be sure, for instance in the first case, an activity update has just been recorded.
function bp_plugin_hook_activity_posted_update( $content, $user_id, $activity_id ) {
// this is a silly example : just to illustrate !!
$activity_count = get_user_meta( $user_id, 'silly_activity_counter' );

$activity_count = empty( $activity_count ) ? 1 : intval( $activity_count ) + 1 ;

update_user_meta( $user_id, 'silly_activity_counter', $activity_count );

}

add_action( 'bp_activity_posted_update', 'bp_plugin_hook_activity_posted_update', 10, 3 );

Of course we could use an equivalent function to count the activity comments of a user by relying on the 『bp_activity_comment_posted』 hook.
Concerning, the other aliases, we need to hook bp_activity_add(). So we』ll have to check for the component argument or the type argument in order to, for instance, add some actions in case of a new topic update or more globally of a group update.
function bp_plugin_hook_group_activity( $args ) {

if( $args['type'] == 'new_forum_topic' )
// a new topic has been posted !!

if( $args['component'] == 'groups' )
// a new group update has been posted !!

}

add_action( 'bp_activity_add', 'bp_plugin_hook_group_activity', 11, 1 );

Once again, as explained earlier, if the activity component is not active, and if you need to fire some actions, for the different types (in other words events) listed in the first chart, you』ll need to rely on other hooks (e.g. : 『groups_group_create_complete』, 『bp_core_activated_user』…). But It』s an article about playing with activities, so i』ll focus on it
Finally we can hook an activity before it has been saved. Although i discourage its use to modify the value of the activity arguments, community admins can use a particular hook to neutralize some mini activities if they wish to. Mini activities don』t have content and are used to log simple events such as the creation of a group, the fact that a member became a member of a group, etc. Lately, i was asked how to avoid recording activities when members are becoming friends or when a member joins a group. This can be achieve by hooking 『bp_activity_before_save』.
function bp_plugin_dont_save_minis( $activity_object ) {
// friendship_created is fired when a member accepts a friend request
// joined_group is fired when a member joins a group.
$exclude = array( 'friendship_created', 'joined_group');

// if the activity type is empty, it stops BuddyPress BP_Activity_Activity::save() function
if( in_array( $activity_object->type, $exclude ) )
$activity_object->type = false;

}

add_action('bp_activity_before_save', 'bp_plugin_dont_save_minis', 10, 1 );

Recording activities for a custom component.
Well it』s quite easy, we just need to use the function bp_activity_add() and to customize its arguments regarding our component need.
function bp_plugin_record_activity() {

$activity_id = bp_activity_add( array(
'action' => 'bp plugin action',
'content' => 'bp plugin content',
/* the component argument will be set to our component's identifier */
'component' => 'bp_plugin',
/* the type argument will be set to our component's type */
'type' => 'bp_plugin_update',
) );

return $activity_id;
}

Now to take a full benefit of our custom activities, we also need to customize the available options of the activity filters that are located in the sitewide Activity directory, in the user』s profile activity page and in the group』s activity page :
function bp_plugin_activity_filter() {
?>

component->id
!important you have to use the BP_Component class to do so
See : https://codex.buddypress.org/bp_component/
***************************************************************************/
$bp->bp_plugin = new stdClass();
$bp->bp_plugin->id = 'bp_plugin';

// Bail if activity is not active
if ( ! bp_is_active( 'activity' ) )
return false;

bp_activity_set_action( $bp->bp_plugin->id, 'bp_plugin_update', __( 'BP plugin update' ) );

}

add_action( 'bp_register_activity_actions', 'bp_plugin_activity_actions' );

Finally if your component』s plugin deals with a custom post type, you can also take benefit of the Site Tracking component to automatically record an activity. Personaly, in this case, i prefer to build my own function to control the activity arguments. But you could filter the hooks 『bp_blogs_record_post_post_types』 and 『bp_blogs_record_comment_post_types』 in order to generate an activity with a type argument of 「new_blog_post」 when a custom post type is published and of 「new_blog_comment」 when a comment is posted on your custom post type.
function bp_plugin_custom_post_type( $post_type ) {
$post_type[] = 'bp_plugin_post_type';

return $post_type;
}

add_filter( 'bp_blogs_record_post_post_types', 'bp_plugin_custom_post_type', 10, 1);
add_filter( 'bp_blogs_record_comment_post_types', 'bp_plugin_custom_post_type', 10, 1);

Fully enjoy bp_activity_set_action()
In the previous section, you』ve seen how to use this function to add the custom plugin activity action to the dropdown filters of the Activity Administration screens.
Since BuddyPress 2.0 and 2.1, this function has evolved and has now 3 more parameters to help plugin developers to have more control on :

the activity action strings (2.0): for a better compatibility with multilingual sites
the dropdown filters on front-end (2.1): if BP Theme Compat is in use or if the custom template is using the function bp_activity_show_filters() to generate the options instead of directly hardcoding them in the templates.

function bp_plugin_activity_actions() {
$bp = buddypress();

/**************************************************************************
for the purpose of this tutorial we arbitrary set the $bp->component->id
!important you have to use the BP_Component class to do so
See : https://codex.buddypress.org/bp_component/
***************************************************************************/
$bp->bp_plugin = new stdClass();
$bp->bp_plugin->id = 'bp_plugin';

bp_activity_set_action(
$bp->bp_plugin->id, // The unique string ID of the component the activity action is attached to
'bp_plugin_update', // the action type
__( 'BP plugin update', 'plugin-domain' ), // the action description used in Activity Administration screens dropdown filters
'bp_plugin_format_bp_plugin_update', // A callable function for formatting the action string
__( 'BP plugin update', 'plugin-domain' ), // the action label of the activity front-end dropdown filters
array( 'activity', 'member' ) // Activity stream contexts where the filter should appear
);
}
add_action( 'bp_register_activity_actions', 'bp_plugin_activity_actions' );

/**
* Callable function for formatting the action string
* Since 2.0 activity action strings are generated dynamically, for a better compatibility with multilingual sites
*/
function bp_plugin_format_bp_plugin_update( $action = '', $activity = null ) {
$action = sprintf( __( '%s shared a new BP plugin update', 'plugin-domain' ), bp_core_get_userlink( $activity->user_id ) );

return $action;
}

As you can see in the above code, you can set the callable function for formatting the action string using the 4th argument of bp_activity_set_action()
You can also set the 5th and 6th argument instead of using the 'bp_activity_filter_options' hook to set the label and the contexts where your option will appear in the available dropdowns :

'': will not display your option in front-end
array( 'activity' ): will display your option only in the activity directory
array( 'activity', 'member' ): will display your option in the activity directory and in the member』s activity page
array( 'activity', 'member', 'member_groups' ): will display your option in the activity directory, in the member』s activity page and member』s groups activity page
array( 'activity', 'groups' ): will display your option in the activity directory and in the single group』s activity page.

Please note that this possibility was introduced in BuddyPress 2.1. It will work for the configs using the templates included in BuddyPress (BP Theme Compat). Some BuddyPress Themes might not have updated their activity templates (activity/index.php, groupssingleactivity.php, memberssingleactivity.php).

会员导航菜单

会员导航菜单

Codex Home → BuddyPress Theme Development → Members Navigation Menus
Members Navigation Menus

With the stable release of BP 1.7 came the introduction of a new means of rendering the members navigational elements.
Long discussed and requested had been the desire to have the menu navigation rendered as a true UL construct with sub menu items as correctly nested ul/li elements as this would allow for not only a far better semantic description of this aspect of nav links but allow for a far greater range of options and flexibility in being able to style them e.g as drop down or fly out sub menu items.
Historically BP rendered the navigational elements as two separate functions bp_get_displayed_user_nav() & bp_get_options_nav() for the child elements making things quite hard to style effectively.
Thanks to the work Paul Gibbs ( @DJPaul ) put in over the 1.7 release cycle we now have a solution and a new template function we can use to replace bp_get_displayed_user_nav() et al. without further ado we welcome to the mix in a fanfare of glory:
bp_nav_menu()
This one function now replaces the previous two to render a true navigational nested UL construct.
Using the function
Using this function really is pretty straightforward however there are a number of aspects that need to be considered and dealt with by the developer.
To use the function we would need to modify the markup in /members/single/home.php by finding this section:

and replacing it with:

In the individual template pages e.g /members/single/activity.php this function needs to be removed from the div#subnav:

Additional Considerations
The above examples are a guide and may need further refining, for instance now the top level parent div 『#object-nav』 could be considered redundant and removed ( it』s left there in the example for the moment as it shouldn』t harm) The same can be said for the parent div 『#subnav』.
In the #subnav we have filters on tabs such as 『Activity』 these are essentially hardcoded select elements that reside in the now redundant ul wrapper in #subnav, in theory it ought to be safe to move this series of elements around as long as one pays attention to class/id tokens so as to not upset any Ajax/JS functionality ( in 1.7 we attempted to unchain JS functions from element selectors i.e 『div』 to instead just hooking on the class or id token alone to allow for greater flexibility in marking up these sorts of elements.)
Styling: At present it is up to the developer implementing this new nav function to understand that they will need to build a series of rulesets to handle the hide /show of child nav items – the elements have all been given appropriate class tokens to aid this. In time and given time perhaps some generic snippets might be provided somewhere for people to download to give them a head start ( the experimental project managed by @DJPaul and @karmatosed 『Turtleshell』 will probably incorporate this new function and basic styling)
Filters, Walkers, Args
The function has been fully scoped with filters, function args, and a walker function.
View the Changeset to see all that can be modified but briefly:
The function can take a series of arguments to modify aspects of the display such as parent elements or classes, this mirrors the functionality of the WP wp_nav_menu() so usage will be familiar to anyone :

$defaults = array(
'after' => '',
'before' => '',
'container' => 'div',
'container_class' => '',
'container_id' => '',
'depth' => 0,
'echo' => true,
'fallback_cb' => false,
'items_wrap' => '

    %3$s

',
'link_after' => '',
'link_before' => '',
'menu_class' => 'menu',
'menu_id' => '',
'walker' => '',
);

There are a full range of filters provided so that you can do things like filter new li items as shown below:
$items = apply_filters( 'bp_nav_menu_items', $items, $args );
This is a brief glimpse of this new function but one that will see increasing usage and deserves a big thanks to DJPaul and the rest of the core lead development team for pulling this out of the hat.

注册和激活页面

注册和激活页面

Codex Home → Getting Started → Register and Activation Pages
Register and Activation Pages

BuddyPress 1.7 auto generates the component pages for you. However, if you have open registration off in the WordPress general settings these pages may not get auto created.
Enable Registration
For users to sign up to your new BuddyPress powered site you will need to enable registration.  Visit  Settings > General in the WordPress admin and make sure you have 「anyone can register」 checked.

For multisite/network installations, navigate to 「My Sites > Network Admin > Settings」 then choose either of the following registration settings available:

Registration is disabled. (default)
User accounts may be registered.
Logged in users may register new sites.
Both sites and user accounts may be registered.

Assign the Pages
After you have enabled registration, you can create the required pages and assign them to the register and activation components. Visit Settings > BuddyPress and then click the Pages tab.

⇐ Getting Started

配置 BuddyPress

配置 BuddyPress

Codex Home → Getting Started → Configure BuddyPress
Configure BuddyPress

After activating BuddyPress, you will be automatically redirected to the BuddyPress Welcome Screen if this is the first time you』ve activated BuddyPress or if you』ve just upgraded BuddyPress. After taking some time to check out the new features added to the plugin, go to wp-admin menu Settings > BuddyPress > Components to begin configuring your installation.
Settings > BuddyPress > Components
By default, BuddyPress Core and the Members components are enabled (Must-Use).  Extended Profiles, Account Settings, Activity Streams, and Notifications components are activated for you.
You can however, selectively disable/enable any of the components later if you choose to do so by using the same form. Your BuddyPress installation will continue to function. However, the features of the disabled components will no longer be accessible to anyone using the site

Available Components
Each component has a unique purpose, and your community may not need each one.

Extended Profiles
Customize your community with fully editable profile fields that allow your users to describe themselves.
Account Settings
Allow your users to modify their account and notification settings directly from within their profiles.
Friend Connections
Let your users make connections so they can track the activity of others and focus on the people they care about the most.
Private Messaging
Allow your users to talk to each other directly and in private. Not just limited to one-on-one discussions, messages can be sent between any number of members.
Activity Streams
Global, personal, and group activity streams with threaded commenting, direct posting, favoriting and @mentions, all with full RSS feed and email notification support.
Notifications
Notify members of relevant activity with a toolbar bubble and/or via email, and allow them to customize their notification settings.
User Groups
Groups allow your users to organize themselves into specific public, private or hidden sections with separate activity streams and member listings.
Site Tracking
Record activity for new posts and comments from your site.

Required Components
The following components are required by BuddyPress and cannot be turned off.

BuddyPress Core: It『s what makes [time travel] BuddyPress possible!
Community Members: Everything in a BuddyPress community revolves around its members.

Settings > BuddyPress > Pages
Pages are automatically generated for the BuddyPress components you enabled in the components settings using the default slugs based on the name of each component activated. Make sure that activated components have corresponding pages assigned to each in this panel.

Directories
Associate a WordPress Page with each BuddyPress component directory.

Activity Streams (if activated)
User Groups (if activated)
Members

Registration
Associate WordPress Pages with the following BuddyPress Registration pages if you want to enable registration.

Register
Activate

Settings > BuddyPress > Options

Main Settings

Toolbar: Show the Toolbar for logged out users (default: enabled)
Account Deletion: Allow registered members to delete their own accounts (default: enabled)

Profile Settings

Profile Photo Uploads: Allow registered members to upload avatars (default: enabled)
Cover Image Uploads:  Allow registered members to upload cover images (default: enabled)
Profile Syncing: Enable BuddyPress to WordPress profile syncing (default: enabled)

Groups Settings

Group Creation: Enable group creation for all users (default: enabled)
Administrators can always create groups, regardless of this setting.
Group Photo Uploads: Allow customizable avatars for groups (default: enabled)
Group Cover Image Uploads: Allow customizable cover images for groups (default: enabled)

Activity Settings

Blog & Forum Comments: Allow activity stream commenting on blog and forum posts (default: disabled)
Activity Auto Refresh: Automatically check for new items by viewing the activity stream (default: enabled)

开发者和设计师信息 BP 1.7

开发者和设计师信息 BP 1.7

Codex Home → Legacy Docs → Archived Section: Getting Started → Developer and Designer Information BP 1.7
Developer and Designer Information BP 1.7

Archived file. Good only for BP 1.7 version

BuddyPress 1.7 Theme Compatibility
* Theme Authors, Make Sure Your Theme Registers BuddyPress Support – @boonebgorges
* Add BuddyPress Styles To a Theme – @modemlooper
* Overview of Theme Compatibility in BP 1.7 (Customization) – @hnla
* Upgrading 「Template Packed」 Themes to BP 1.7 Theme Compatibility – @mercime
* New Members Navigation Menus – @hnla
Plugins for BuddyPress 1.7
* Using theme compatibility in plugins – @imath
* Upgrading Older Plugins That Bundle Custom Templates for BP 1.7 – @r-a-y
BP 1.7 Developers and Contributors

模板层次结构

模板层次结构

Codex Home → BuddyPress Theme Development → Theme Compatibility → Template Hierarchy
Template Hierarchy

A detailed look at theme compatibilities template hierarchy
BuddyPress 1.7 introduced universal theme compatibility making it easier for WordPress theme designers to work with BuddyPress.
What this means is if you are on a BuddyPress page, BuddyPress will look for a specific template file in your theme and use that template to inject its contents into.
If you』re unfamiliar with BP』s Theme Compatibility please read this guide first which explains the templates and how and where to overload them theme compatibility
The base templates that BP looks for in order of priority are:

plugin-buddypress.php
buddypress.php
community.php
generic.php
page.php
single.php
singular.php
index.php

Most of the time BP will use page.php since that template file exists in the majority of WordPress themes. However, if you wanted to style BuddyPress pages differently than a regular WordPress page, you could add a template file named buddypress.php to your theme』s directory and BP would use that template instead since that file is ahead of page.php in the hierarchy above.
See also: a-quick-look-at-1-7-theme-compatibility for an introduction to theme compatibility and how to overload the templates to your child theme
This is all fine and dandy if you wanted all your BuddyPress pages to look the same, but let』s say I wanted to style the member pages differently than group pages? You』ll notice that this isn』t quite possible.
What if BuddyPress had a more advanced template hierarchy that looked for additional template files depending on the BuddyPress page you』re on?
BuddyPress 1.8 solves this problem.
Overview of Template Hierarchy in BuddyPress
Single Member Pages
If you are on a single member page, BuddyPress will use the following template hierarchy:
(We will use the following URL as an example – example.com/members/admin/activity/mentions/)

/buddypress/members/single/index-id-{id}.php – If the member profile』s user ID is 1, BuddyPress will look to use /buddypress/members/single/index-id-1.php first.
/buddypress/members/single/index-nicename-{nicename}.php – If we look at the sample URL, the user』s nicename is admin, BuddyPress will look to use /buddypress/members/single/index-nicename-admin.php second.
/buddypress/members/single/index-action-{action}.php – If we look at the sample URL, the action is mentions, BuddyPress will look to use /buddypress/members/single/index-action-mentions.php third.
/buddypress/members/single/index-component-{component}.php – If we look at the sample URL, the component is activity, BuddyPress will look to use /buddypress/members/single/index-component-activity.php fourth.
/buddypress/members/single/index.php – If this template file is used in your theme, all member pages will use this template. BP will look to use this if the other four templates mentioned above are not found.
The rest of the base templates as listed here.

Single Member Front page
Since version 2.6.0, if a front.php template is located into the /buddypress/members/single/ directory it will be used as the home page for members profile pages. This template is not included into the BP Legacy template pack. Themes can use it to customize the Member』s home page. If you need different front pages for your users, you can use this template hierarchy:

/buddypress/members/single/front-id-{id}.php – If the member』s ID is 42, BuddyPress will look to use /buddypress/members/single/front-id-42.php first.
/buddypress/members/single/front-nicename-{nicename}.php – If the member』s nicename is 「john」, BuddyPress will look to use /buddypress/members/single/front-nicename-john.php second.
/buddypress/members/single/front-member-type-{member-type}.php – If you registered member types (see this codex page), you can use the member type name to build different front pages for each member type. For instance BP will look to use /buddypress/members/single/front-member-type-student.php if the other two templates mentioned above are not found and the displayed user has the 「student」 member type.
/buddypress/members/single/front.php – If none of the above are found.

If you have trouble determining the action or component, you could try using this small debug plugin to help output information about the current BuddyPress page.
Single Group Pages
If you are on a single group page, BuddyPress will use the following template hierarchy:
(We will use the following URL as an example – example.com/groups/my-test-group/members/)

/buddypress/groups/single/index-id-{id}.php -If the group』s ID is 1, BuddyPress will look to use /buddypress/groups/single/index-id-1.php first.
/buddypress/groups/single/index-slug-{slug}.php – If we look at the sample URL, the slug is my-test-group, BuddyPress will look to use /buddypress/groups/single/index-slug-my-test-group.php second.
/buddypress/groups/single/index-action-{action}.php – If we look at the sample URL, the action is members, BuddyPress will look to use /buddypress/groups/single/index-action-members.php third.
/buddypress/groups/single/index-status-{status}.php – Either public, private or hidden. So let』s say you wanted all private groups to have a similar look, you would want to add the following template – /buddypress/groups/single/index-status-private.php. BP will look to use this if the other three templates mentioned above are not found.
/buddypress/groups/single/index.php – If this template file is used in your theme, all group pages will use this template. BP will look to use this if the other three templates mentioned above are not found.
The rest of the base templates as listed here.

Single Groups Front page
Since version 2.4.0, we added a template hierarchy to the front.php template. This template is not included into the BP Legacy template pack. Themes can use it to customize the Group』s home page.

/buddypress/groups/single/front-id-{id}.php – If the group』s ID is 1, BuddyPress will look to use /buddypress/groups/single/front-id-1.php first.
/buddypress/groups/single/front-slug-{slug}.php – If we look at the sample URL, the slug is my-test-group, BuddyPress will look to use /buddypress/groups/single/front-slug-my-test-group.php second.
/buddypress/groups/single/front-group-type-{type}.php – (Since 2.6.0) If the group has the type of 「team」, BuddyPress will look to use /buddypress/groups/single/front-group-type-team.php next.
/buddypress/groups/single/front-status-{status}.php – Either public, private or hidden. So let』s say you wanted all public groups to have a similar front page, you would want to add the following template – /buddypress/groups/single/front-status-public.php. BP will look to use this if the templates mentioned above are not found.
/buddypress/groups/single/front.php – If none of the above are found.

If you have trouble determining the slug, action or status, you could try using this small debug plugin to help output information about the current BuddyPress page.
Activity Permalink pages
If you are on an activity permalink page, BuddyPress will use the following template hierarchy:

/buddypress/activity/single/index.php
The rest of the base templates as listed here.

Activity Directory page
If you are on the activity directory page, BuddyPress will use the following template hierarchy:

/buddypress/activity/index-directory.php
The rest of the base templates as listed here.

Member Directory page
If you are on the members directory page, BuddyPress will use the following template hierarchy:

/buddypress/members/index-directory-type-{member_type}.php when viewing member type specific directory page, {member_type} is the current member type.
/buddypress/members/index-directory.php
The rest of the base templates as listed here.

Group Directory page
If you are on the groups directory page, BuddyPress will use the following template hierarchy:

/buddypress/groups/index-directory.php
The rest of the base templates as listed here.

Group Creation page
If you are on the group creation page, BuddyPress will use the following template hierarchy:

/buddypress/groups/index-create.php
The rest of the base templates as listed here.

Site Directory page
Only applicable if you are running WordPress multisite.
If you are on the site directory page, BuddyPress will use the following template hierarchy:

/buddypress/blogs/index-directory.php
The rest of the base templates as listed here.

Site Creation page
Only applicable if you are running WordPress multisite.
If you are on the site creation page, BuddyPress will use the following template hierarchy:

/buddypress/blogs/index-create.php
The rest of the base templates as listed here.

Registration page
If you are on the registration page, BuddyPress will use the following template hierarchy:

/buddypress/members/index-register.php
The rest of the base templates as listed here.

Activation page
If you are on the activation page, BuddyPress will use the following template hierarchy:

/buddypress/members/index-activate.php
The rest of the base templates as listed here.

群组的管理 UI 界面

群组的管理 UI 界面

Codex Home → BuddyPress Plugin Development → Admin UI for Groups
Admin UI for Groups

In BuddyPress 1.7, the Groups Component comes with a great Admin UI that allows Community Administrator to easily manage the created groups (members, settings…) directly from the WordPress backend.
Edit Group Admin Screen
As plugin authors, I think we should enjoy this new area and let the Community Administrator manage the settings of the group extension we might use in our custom component. To do so, I think the best way is to enrich the class we use to extend the BP Group Extension API.
Let』s consider this class as our plugin』s group component, just to refresh our memory about the BP Group Extension API  class and its functions:
class Bp_Plugin_Group extends BP_Group_Extension {
function __construct() {}
function create_screen() {}
function create_screen_save() {}
function edit_screen() {}
function edit_screen_save() {}
function admin_screen() {}
function admin_screen_save() {}
function display() {}
function widget_display() {}
function enable_nav_item() {}
}
bp_register_group_extension( 'Bp_Plugin_Group' );

Adding a meta box for our component in the 「Edit Group」 Admin screen.
When creating your component utilizing the BP Group Extension API you can include the functions below to add a meta box to the Group Admin Page. You can create anything from displaying group content or allowing an admin to update the group meta. The  admin_screen_save() function has an example of getting form parameters out of the $_POST global and saving it into the group meta.
function admin_screen( $group_id ) {
?>

The HTML for my admin panel.

name ) ?>

You could display a small snippet of information from your group extension here. It will show on the group
home screen.

<?php
}
}

BuddyPress 小工具

BuddyPress 小工具

Codex Home → BuddyPress Theme Development → BuddyPress Widgets
BuddyPress Widgets

BuddyPress provides widgets which you can add to any of your theme』s widget areas. To activate these, go to dashboard menu Appearance > Widgets.

(BuddyPress) Friends
(BuddyPress) Groups
(BuddyPress) Log In
(BuddyPress) Members
(BuddyPress) Recently Active Members
(BuddyPress) Sitewide Notices
(BuddyPress) Who』s Online
(BuddyPress) Recent Networkwide Posts – Multisite Installations only

(BuddyPress) Friends
A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.
Options
Link widget title to Members directory – optional
Maximum friends to show – default is 5
Default friends to show: Newest, Active, or Popular

(BuddyPress) Groups
A dynamic list of recently active, popular, and newest groups
Options
Title: Set the title to be displayed in the sidebar – optional
Link widget title to Groups directory – optional
Maximum groups to show – default is 5
Default groups to show: Newest, Active, or Popular

(BuddyPress) Log In
Show a Log In form to logged-out visitors, and a Log Out link to those who are logged in.
Option
Title: Set the title to be displayed in the sidebar – optional

(BuddyPress) Members
A dynamic list of recently active, popular, and newest members
Options
Title: Set the title to be displayed in the sidebar – optional
Link widget title to Members directory – optional
Maximum members to show
Default members to show: Newest, Active, or Popular

(BuddyPress) Recently Active Members
Profile photos of recently active members
Options
Title: Set the title to be displayed in the sidebar – optional
Maximum members to show – default is 15

(BuddyPress) Sitewide Notices
Display Sitewide Notices posted by the site administrator
Option
Title: Set the title to be displayed in the sidebar – optional

(BuddyPress) Who』s Online
Profile photos of users who are currently online
Options
Title: Set the title to be displayed in the sidebar – optional
Maximum members to show – default is 15

(BuddyPress) Recent Networkwide Posts
A list of recently published posts from across your network (multisite)
Options
Title: Set the title to be displayed in the sidebar – optional
Link widget title to Blogs directory – optional
Maximum posts to show – default is 10

bp_after_setup_theme()

bp_after_setup_theme()

Codex Home → Developer Resources → Function Examples → bp_after_setup_theme()
bp_after_setup_theme()

bp_after_setup_theme() is where BuddyPress loads the theme functions. If you want to filter actions in functions.php or buddypress-functions.php hook to bp_after_setup_theme().
add_action( 'bp_after_setup_theme', 'bp_load_theme_functions', 1 );

Source File
bp_after_setup_theme() is located in bp-core/bp-core-dependency.php