自动化测试

自动化测试

Codex Home → Developer Resources → Automated Testing
Automated Testing

BuddyPress contains a suite of automated tests. These tests are designed to prevent the accidental introduction – or reintroduction – of bugs. If you are a developer of BuddyPress plugins, or if you are contributing to BuddyPress core, please consider using (and writing!) these tests.
The BuddyPress test system is based on, and uses, the WordPress suite. Before getting started, you are encouraged to read more about how WordPress tests work.
Installation

Set up the WordPress test suite. You』ll need to install PHPUnit, check out the WordPress core test repository, create a blank MySQL database, and set up your wp-tests-config.php file. Follow the instructions in the WordPress contributor handbook to get set up. The WordPress test suite can be located anywhere on your development machine, though it』s recommended that you place it somewhere outside your normal WordPress/BuddyPress development environment.
Check out the BuddyPress Subversion repository. At the moment, we do not plan to distribute the test suite with the .zip download of BuddyPress. To use the BuddyPress test suite, you』ll need to check out BuddyPress trunk from buddypress.trac.wordpress.org.
$ svn co https://buddypress.svn.wordpress.org/trunk buddypress
Please note that your checkout of BuddyPress trunk must be at or beyond revision 6908.
Define WP_TESTS_DIR in your bash profile (optional). The test suite requires an environment variable WP_TESTS_DIR that defines the location of your checkout of the WordPress tests. While it』s possible to define the environment variable each time you run the tests, ie, WP_TESTS_DIR=~/sites/tests/phpunit and then export using export WP_TESTS_DIR, you』ll probably find it useful to set the variable permanently in your bash profile. On OS X or Linux, add the following line to ~/.bashrc:
export WP_TESTS_DIR="/home/bgorges/sites/tests/phpunit"
(changing the path to wherever you installed the WP tests in step 1). To apply these changes, source ~/.bashrc.

Running the tests
Navigate to the tests subdirectory of the BuddyPress plugin folder, and type phpunit. (If you didn』t add WP_TESTS_DIR to your bash profile in step 3 above, you』ll need to define that environment variable inline.) Then:
$ phpunit

为依赖 BuddyPress 的插件编写自动化测试

为依赖 BuddyPress 的插件编写自动化测试

Codex Home → Developer Resources → Automated Testing → Writing automated tests for BuddyPress-dependent plugins
Writing automated tests for BuddyPress-dependent plugins

The automated testing suite introduced into BuddyPress after 1.7 make it easy to write unit tests for your BP-dependent plugins. Our implementation assumes that you』ll be writing your plugin tests according to wordpress-plugin-tests method. If you』re new to writing WordPress plugin tests, it』s highly recommended that you use the wordpress-plugin-tests technique (or, even easier, the wp-cli unit-tests scaffold tool.
BuddyPress provides two useful kinds of utilities that your plugin』s tests can take advantage of. We』ll discuss the two utilities briefly, and follow it with a working example.
Note: In this tutorial, we』ll be extending BP』s test suite for use in a plugin. But a similar technique could be used for BP themes, as well as for setting up integration tests for an entire, highly-customized BuddyPress installation.

BuddyPress installation and bootstrapping – If your plugin depends on BuddyPress, then you』ll need to make sure that BuddyPress is installed and running when running your tests. Establishing the proper dependencies manually can be very tricky, because BP』s setup routine requires the installation of custom tables and other important one-time configuration, and it all has to happen in a very specific order in order to have a functioning version of BuddyPress. Luckily, you don』t have to do it manually. Just require buddypress/tests/phpunit/includes/loader.php in a callback function hooked to muplugins_loaded using tests_add_filter() – right before you manually load your own plugin – and BP will make sure that (1) BP gets installed correctly, and (2) BP is fully loaded.
BP_UnitTestCase and data factories – When you use the BP_UnitTestCase class for your test cases, you automatically get access to some helpful utility methods (such as go_to(), which is sensitive to the requirements of BP URLs), as well as the BuddyPress data factories for generating groups, activity, and other BP test data. Does your plugin have additional data factories? Consider building your own _UnitTestCase that extends BP_UnitTestCase.

What follows is an annotated bootstrap.php that demonstrates the best way to take inherit BP』s unit testing tools in your own plugin』s test suite. The plugin in the example can be found at BP-CLI, and the code below is from the file bp-cli/tests/bootstrap.php. You should be able to copy and paste this code into your own tests/phpunit/bootstrap.php file – just change the paths for your plugin loader file, and your optional _UnitTestCase class file.
<?php

// The BP_TESTS_DIR constant is a helpful shorthand for accessing assets later
// on. By defining in a constant, we allow for setups where the BuddyPress
// tests may be located in a non-standard location.
if ( ! defined( 'BP_TESTS_DIR' ) ) {
define( 'BP_TESTS_DIR', dirname( __FILE__ ) . '/../../buddypress/tests/phpunit' );
}

// Checking for the existence of tests/phpunit/bootstrap.php ensures that your version
// of BuddyPress supports this kind of automated testing
if ( file_exists( BP_TESTS_DIR . '/bootstrap.php' ) ) {

// The functions.php file from the WP test suite needs to be defined early,
// because it gives us access to the tests_add_filter() function
require_once getenv( 'WP_TESTS_DIR' ) . '/includes/functions.php';

// Hooked to muplugins_loaded, this function is responsible for bootstrapping
// BuddyPress, as well as your own plugin
function _bootstrap_plugins() {

// loader.php will ensure that BP gets installed at the right time, and
// that BP is initialized before your own plugin
require BP_TESTS_DIR . '/includes/loader.php';

// Change this path to point to your plugin's loader file
require dirname( __FILE__ ) . '/../bp-cli.php';
}
tests_add_filter( 'muplugins_loaded', '_bootstrap_plugins' );

// Start up the WP testing environment
require getenv( 'WP_TESTS_DIR' ) . '/includes/bootstrap.php';

// Requiring this file gives you access to BP_UnitTestCase
require BP_TESTS_DIR . '/includes/testcase.php';

// Optional: If your plugin needs its own _UnitTestCase class, include it
// here so that it's available when your testcases are loaded
require dirname( __FILE__ ) . '/bp-cli-testcase.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.

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

信息 (Messages)

信息 (Messages)

Codex Home → Administrator Guide → Messages
Messages

Sections

Public Messages
Private Messages

Private Message Screens
How to Send a Private Message

Public Messages
BuddyPress provides ways for you to send a message publicly to another member of the site or network. Members will be notified of public messages by a new message count in the Notifications circle in Admin/Toolbar as well as receive an email notifications, if enabled by said member.

Mention the member by using the 「at sign」 ( @ ) + member username, e.g. @mercime. Mentioning the user can be done anywhere within the BuddyPress site:

Status Update form in the Sitewide Activity page, Group Activity page or in your own profile page
Activity Stream Comment and/or Reply form
Forum Topic Post or Reply Post – if the bbPress forums (sitewide or group) plugin is activated in your site

Click on the Public Message button located beside the member』s avatar in his/her profile page (see image above). That brings you to your own Activity Status Update form with that member』s username already mentioned. Add your message and click on Post Update button.

Private Messages
Private Messaging works like an internal site email. Members can message people on their friends list as well as reply to received messages. Each member will have their own individual Inbox and Sent messages folders as well as a Compose message screen. Members will be notified of new messages by a new message count in own Messages tab, in notification circle in Admin toolbar, as well as receive email notifications of the private message, if enabled.
Private Message Screens

Inbox – Shows the list of Private Message/s sent to your by members of the site. Visible to the logged in member only.Options

Search Messages
Read Message
Delete Message
Bulk Delete Messages – Select Read, Unread or All Messages

Sent – Shows the list of Message/s you have sent to other members of the site. Visible to the logged in member only.Options

Search Sent Messages
Read Sent Message
Delete Sent Message
Bulk Delete Sent Messages – Select Read, Unread or All Messages

Compose – Shows a form to send messages. Visible to logged in member only.Input

Send To (Username or Friend』s Name) field
Super Admin Only: Checkbox for 「This is a notice to all users.」
Subject field
Message field
Send Message button

Super Admin Only: Notices – Shows a list of Sitewide Notices broadcasted and date sent via Compose panel. The Super Admin』s notice will show up in the sidebar for logged in members only (BP Default theme) who in turn, can click on the 「Close」 link at the end of the notice – hopefully after they』ve read the message first. The following buttons are visible to the Site/Super Admin only.

Deactivate (notice) button
Delete (notice) button

How to Send a Private Message
Via member』s Private Message button

Go to the member』s profile page
Click on the Private Message button in the member』s header area and you will be redirected to your Messages > Compose screen
Member』s username is already entered as addressee
Enter the Title of your message
Enter content of your message
Click on the Send Message button
The logged in member will be notified about the message via Notification alert in the Admin Toolbar and via email if enabled.

Via your Account navigation in Admin Toolbar

Hover over your account Messages > click on Compose and you will be redirected to your Messages > Compose screen
Enter the username or the display name of your friend
Enter the Title of your message
Enter content of your message
Click on the Send Message button
The logged in member will be notified about the message via Notification alert in the Admin Toolbar and via email if enabled.

用户扩展个人资料

用户扩展个人资料

Codex Home → Administrator Guide → User Extended Profiles
User Extended Profiles

Highlight the best of your community members by creating an unlimited number of Extended Profile (xProfile) Fields and/or groups of Extended Profile Fields custom-made for your social network.
To start creating xProfile fields, go to administration menu Users > Profile Fields. If you have a multisite installation with BuddyPress activated network-wide via Network Admin > Plugins, you』ll find the Profile Fields admin screen via Network Admin > Users > Profile Fields
Sections

Add New xProfile Field
Add New xProfile Field Group
Rearranging xProfile Fields or Field Groups

Add New xProfile Field

Fields marked * are required.
Fields in the 「Base」 (Primary) group will appear on the signup/register page.
Input
Field Title*
Field Description
Is this field required?
Select
Not Required
Required

Field Type:
Select
Single Line Text Box
Multi-line Text Box
Date Selector
Radio Buttons
Dropdown Select Box
Multiple Select Box
Checkboxes

Default Visibility
Options
Anyone (default)
Logged In Users
Admins Only
My Friends

Per-Member Visibility
Options
Let members change this field』s visibility {default)
Enforce the default visibility for all members

Save button, Cancel link

Edit Group button – allows you add, remove, move or change any xProfile field in the specific xProfile Group
Name (Primary)(Required) Field – Nice Name
Edit Field button – opens up a new screen
Input
Field Name (Required)
Field Description

Add New xProfile Field Group

The Add New Field Group button is located beside the Profile Fields component title. Click on the button to create a new Profile Group where you can later add more xProfile Fields

Title of xProfile Field Group
(Field) Group Description
Create Field Group button or Cancel link

Rearranging xProfile Fields or xProfile Field Groups
A. Change order of xProfile Fields within a Profile Field Group:
You can change the order by which xProfile Field/s show up in the Registration Form or in the Member』s Profile area by dragging the field up or down within the field group to the preferred location.

B. Change order of xProfile Field Groups:
You can change the order by which your xProfile Field Groups show up in Member』s Profile area by dragging the Group Tab to the left or right in Users > Profile Fields screen. Remember that only the Base (Primary) Field Group shows up in the Registration Form.

C. Move an xProfile Field from one xProfile Field Group to Another:
1. Click on the xProfile Field Group tab to open the panel where the xProfile Field you want to move is located.
2. Drag that xProfile Field to the xProfile Field Group tab where you want to move the xProfile Field.
3. You can then rearrange the position of the xProfile Field in new field group by dragging up or down to where you want to position the xProfile Field within the new group.

活动流 (Activity Streams)

活动流 (Activity Streams)

Codex Home → Administrator Guide → Activity Streams
Activity Streams

Activity streams aggregate all of your activities across a BuddyPress installation.
Enabled BuddyPress components make use of the activity stream component, which means any sort of activity can be recorded. Blogs posts, new friendships and blog comments are among the most popular activities recorded. Furthermore, custom components can also hook into the activity streams, meaning any sort of data can be tracked and recorded.
Following are the the pages rendered in the front end of your site when the Activity Component is activated.

Sitewide Activity Stream
Member Activity Stream
and if the Groups Component is active:
Group Activity Stream

Sitewide Activity Stream
Shows all activities throughout the site or network (if multisite)
Sitewide Activity Stream on BP Default Theme. Click on image to enlarge.
Sections
RSS feed
Selectbox: Show: Everything (default), Updates, Posts, Comments, New Groups, Group Memberships, Friendships, New Members
Status Update – visible to all logged in members only

Text Area box
Post In – Selectbox: Member』s Profile Page or to one of Membes』s Groups
Post Update button

Following buttons/links are visible to logged in members only

Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button – visible only to Super/Site Admin.

Member Activity Stream
Shows the Member』s activities throughout the site.
Sections Member Activity Stream on Twenty Twelve Theme. Click on image to enlarge.
Personal – Shows your activities throughout the site. The status update form and following buttons are visible for logged-in members only.

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Status Update – visible to all logged in members only

Text Area box
Post In – Selectbox: Member』s Profile Page or to one of Membes』s Groups
Post Update button

Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button

Mentions – Shows a list of all @mentions for you. The following buttons are visible for logged-in members only.

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Favorites – Shows a list of all items you clicked as 「Favorite」. The following buttons are visible to the member only.

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button

Friends – Shows Activity Streams of your friends. The following buttons are visible for logged-in members only.

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Groups – Shows the Activity Streams of the groups you』ve joined. The following buttons are visible to the member only.

Selectbox – Show: Everything (default), Updates, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Group Activity Stream
Shows the specific Group』s Activity Stream which is the default Home tab for any group.
Group Activity Stream on the Twenty Thirteen Theme. Click on image to enlarge.
Sections
RSS feed
Selectbox: Show: Everything (default), Updates, Group Memberships
Status Update – visible to all logged in members only

Text Area box
Post In – Selectbox: Member』s Profile Page or to one of Membes』s Groups
Post Update button

Following buttons/links – visible to logged in group members only

Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button – visible only to Group Admin, Group Moderator and Super/Site Admin.

⇒ Related: Activity Stream Management Screens

会员 (Members)

会员 (Members)

Codex Home → Administrator Guide → Members
Members

BuddyPress makes it easy for you to build your community or social network and establish relationships among members with default components such as Extended Profiles, Activity Streams, Friend Connections, Private Messaging, User Groups, and Blogs (multisite installation only) and major features like Notifications.
The following is an overview of the default membership features using BuddyPress.
Sections

Members Directory
Single Member

Member』s Header
Activity Screens
Profile Screens
Messages Screens
Friends Screens
Groups Screens
Settings Screens

Members Directory
Members Directory. Click on image to enlarge.
Options

Search Members search form
All Members tab – with total number of registered users who have logged in at least once after BuddyPress was activated in the installation.
Selectbox – Show: Last Active (default), Newest Registered, or Alphabetical
List of Members registered in the site including time active stamp, latest status update (if any), and latest post (if any)Additional Information

Latest Status Update (if any)
Latest Post (if any)

Action buttons – visible to logged in members only

Add Friend (friendship request) button or Cancel Friendship Request button

My Friends tab – for logged in users only, has total number of friends you have made in the site Sections

Selectbox – Show: Last Active (default), Newest Registered, or Alphabetical
List of your friends
Cancel Friendship button – shows up in row alongside all members in the list

Member』s Header
Member』s Header Area. Click on image to enlarge.
Sections

Member』s Avatar or Site』s Default Avatar
Member』s Nice Name
Member』s Username
Member』s Latest Status Update (if any)
Action buttons – visible to logged in members only

Add Friend (request friendship) button or Cancel Friendship button (if friendship had already been accepted)
Public Message button – opens up your Activity > Personal screen with the member』s username mentioned, e.g. @cottoncandy, in your Status Update box
Private Message button – opens up your Messages > Compose screen with the member』s username already included

Member Activity

Personal – Shows your activities throughout the site. The status update form and action buttons are visible for logged in member only.Options

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Status Update – visible to all logged in members only Options

Text Area box
Post In – Selectbox: Member』s Profile Page or to one of Members』s Groups
Post Update button

Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button

Mentions – Shows a list of all @mentions addressed to you. Action buttons below are visible for logged in member only.Options

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Favorites – Shows a list of all items you clicked as 「Favorite」. Action buttons below are visible to the member only.Options

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button
Delete button

Friends – Shows Activity Streams of your friends. Action buttons below are visible for logged-in members only.Options

Selectbox – Show: Everything (default), Updates, Posts, Comments, Friendships, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Groups – Shows the Activity Streams of the groups you』ve joined. Action buttons below are visible to the member only.Options

Selectbox – Show: Everything (default), Updates, New Groups, or Group Memberships
Comment button
Reply to Comment link
Favorite button or Remove Favorite button

Member Profile

View – Shows the profile fields you』ve filled up during registration (Base) and any other additional fields which could have been set up by the Site Admin in other profile group/s.
Edit – Panel where you can revise the fields you』ve filled up before or enter information to profile fields which you haven』t filled up yet. Shown for logged in member only.
Change Avatar – Your avatar will be used on your profile and throughout the site. If there is a Gravatar associated with your account email we will use that, or you can upload an image from your computer – .jpg, .gif or .png format. Shown for the logged in member only.Options

Choose File button (no file chosen)
Upload Image button
In next panel, Crop Image

Member Messages

Inbox – Shows the list of Private Message/s sent to your by members of the site. Visible to the logged in member only.Options

Search Messages
Read Message
Delete Message
Bulk Delete Messages – Select Read, Unread or All Messages

Sent – Shows the list of Message/s you have sent to other members of the site. Visible to the logged in member only.Options
Compose Private Message. Click on image to enlarge.

Search Sent Messages
Read Sent Message
Delete Sent Message
Bulk Delete Sent Messages – Select Read, Unread or All Messages

Compose – Shows a form to send messages. Visible to logged in member only.Input

Send To (Username or Friend』s Name) field
Site Admin Only: Checkbox for 「This is a notice to all users.」
Subject field
Message field
Send Message button

Site Admin Only: Notices – Shows list of Sitewide Notices and date sent via Compose panel. The Admin』s notice will show up in the sidebar for logged in members only who in turn, can click on the 「Close」 link at the end of the notice – hopefully after they』ve read the message first. The following buttons are visible to the Site/Super Admin only.Options

Deactivate (notice) button
Delete (notice) button

Member Friends

Friendships – Shows a list of friendships accepted.Options

Select Order by: Last Active, Newest Registered or Alphabetical
View link to friend』s latest status update.
Cancel Friendship button – Visible to logged in member only.

Requests – Shows list of members who have requested friendship with you by clicking on 「Add Friend」 button in Members Directory Page or in your Profile pages. The following buttons are visible to the member only.Options

Accept button
Accepted – message on screen confirming you have accepted someone』s friendship request
Reject button

Member Groups

Memberships – Shows the list of Groups that you』ve joined.Options

Select Order by: Last Active, Newest Registered or Alphabetical
Leave Group button – only for groups you』ve joined, not in groups you』re the Group Admin of. Visible to logged in member only.

Invitations – Visible to logged in member only.Options

Accept button
Reject button

Member Settings
This whole section section is visible for the respective logged in user and the Super/Site Admin only.

GeneralOptions

Current Password (required to update email or change current password) area
Lost your password? link
Account Email input box
Change Password (leave blank for no change)

New Password area
Repeat New Password area

Save Changes button

Notifications – Each event listed below will trigger notification alerts in the site (bubble in WP Toolbar) and by email by default. You have the option of disabling email notifications for any or all of the events listed.
Email notification: Send Notification when (default setting: Yes):

ActivityOptions

A member mentions you in an update using 「@your-username」 – Yes or No radio button
A member replies to an update or comment you』ve posted – Yes or No radio button

MessagesOptions

A member sends you a new message – Yes or No radio button

FriendsOptions

A member sends you a friendship request – Yes or No radio button
A member accepts your friendship request – Yes or No radio button

GroupsOptions

A member invites you to join a group – Yes or No radio button
Group information is updated – Yes or No radio button
You are promoted to a group administrator or moderator – Yes or No radio button
A member requests to join a private group for which you are an admin – Yes or No radio button

Save Changes button

Delete Account – Shows up if deleting account is enabled by Site AdminOptions

Warning: Deleting your account will delete all of the content you have created. It will be completely irrecoverable.
Checkbox: I understand the consequences.
Delete Account button

如何加入私人群组

如何加入私人群组

Codex Home → Member Guide → How To Join a Private Group
How To Join a Private Group

Sections

Groups Directory Page – with example of rejected membership request
Single Group Page – with example of accepted membership request

Groups Directory Page
1. In your site』s Group Directory page, click on the 「Request Membership」 button of the Private Group you want to join.
Click on image to enlarge.
2. You』ll see the 「Request Membership」 text in button change to 「Membership Requested」.
Click on image to enlarge.
3. Your request to join the group is sent to the Private Group』s Admin via email (if enabled) and via notification in the Group Admin』s BuddyPress member navigation in the WordPress Toolbar shown below.

4. When the Group Admin of that private group clicks on the notification link in WP Toolbar or the link in the email notification received, the Group Admin is brought to the private group』s Admin > Requests screen. The Group Admin can either click on the 「Accept」 button or the 「Reject」 button. In this example, the Group Admin will choose to reject the request for group membership.
Click on image to enlarge.
5. The Group Admin sees a confirmation message: 「Group membership request rejected.」
Click on image to enlarge.
6. The member whose request has been rejected receives an email (if enabled) and notification in the WP Toolbar which when opened shows: Membership for group 「name_of_group」 rejected.

Single Group Page
1. If you want to attach a message to the Group Admin when you request membership to join the private group, going to the private group』s home page is the option to choose. Click on the 「Request Membership」 button or on the 「Request Membership」 tab in the private group』s header area.
Click on image to enlarge.
2. A textarea will show up so you could add your message to the Group Admin. Click on the 「Send Message」 button to send the message along with the request for membership in the private group.
Click on image to enlarge.
3. The member requesting membership in the private group sees a confirmation message 「Your membership was sent to the group administrator successfully. You will be notified when the group administrator responds to your request.」
Click on image to enlarge.
4. Your request to join the group is sent to the Private Group』s Admin via email (if enabled) and via notification in the Group Admin』s BuddyPress member navigation in the WordPress Toolbar shown below.

5. When the Group Admin of that private group clicks on the notification link in WP Toolbar or the link in the email notification received, the Group Admin is brought to the private group』s Admin > Requests screen. The message of the member requesting the membership is shown along with the 「Accept」 button or the 「Reject」 buttons. In this example, the Group Admin will choose to accept the request for group membership.
Click on image to enlarge.
6. The Group Admin sees a confirmation message 「Group membership request accepted.」
Click on image to enlarge.
7. The member who applied for membership in the private group receives an email (if enabled) and a notification on site in the WP Toolbar which when clicked on shows: Membership for 「name_of_group」 accepted.

8. When the member who got accepted to the private group clicks on the notification, the member is redirected to the private group』s home page – the private group』s activity screen.
Click on image to enlarge.

⇐ Back to Member Guide

模板层次结构

模板层次结构

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.