版本编号

版本编号

Codex Home → Getting Started → Version numbering
Version numbering

Beginning with version 4.0.0 (#7710), BuddyPress releases are numbered according to a slightly modified version of Semantic Versioning (SemVer).

As in SemVer, BuddyPress version numbers follow the MAJOR.MINOR.PATCH format, where:

MAJOR releases are those that include major new features, and may incorporate backward-incompatible API changes. We make an effort to document such changes on our dev blog https://bpdevel.wordpress.comMINOR releases include backward-compatible bug fixes and minor functionalityPATCH releases include backward-compatible bug fixes or security fixes only

Prior to 4.0.0, BuddyPress releases followed WordPress』s MAJOR.MINOR format, where MAJOR is a one-place decimal (of the format x.y, such as 2.8) that represents new features, and MINOR is .z (such as 2.8.1) that includes bug fixes only.

BuddyPress 提交访问

BuddyPress 提交访问

Codex Home → BuddyPress commit access
BuddyPress commit access

What is commit access?
The code that comprises BuddyPress is written by volunteers. Anyone who wants to suggest an improvement or a bugfix to the BP codebase is welcome to do so, by submitting their proposed changes to our Trac site.
The ability to add patches directly to BuddyPress is limited to those with commit access to the BP Subversion repository. Committers are individuals who have demonstrated, through ongoing contribution to the codebase and the BuddyPress community, a deep understanding of the codebase as well as the project ethos.
What is the role of a committer?
The primary duty of a committer is to assist community members with their code contributions to the project, through code review, technical consultation, and committing patches. When reviewing contributions, a number of different kinds of considerations should be weighed. First, the technical merits of a proposed change: performance, security, architectural and stylistic coherence with the rest of the codebase, etc. Just as important are the strategic and philosophical appropriateness of a contribution – whether it moves us closer to project goals, and so forth.
The BP project is proud of its collaborative nature. Most large architectural decisions in BuddyPress are made by rough consensus, and peer code review is an important part of the project culture. However, committers have the right to make final decisions about most issues: commit access means that you don』t need permission to make changes to BuddyPress. In cases where committers cannot come to consensus about technical decisions, the lead developers may serve as tiebreakers.
How are committers chosen?
Individuals may be nominated for guest commit access by any current committer. Nominations are reviewed by existing committers, with lead developers serving as the final decision makers. Guest committers may be offered permanent commit status at the discretion of the team.
Current committers
The following contributors have commit access to BuddyPress: John James Jacoby, Paul Gibbs, Boone Gorges, r-a-y, Mathieu Viet, mercime, Hugo Ashmore, David Cavins, Michael Beckwith, Slava Abakumov, Stephen Edgar and Laurens Offereins.

活动流和 date_query

活动流和 date_query

Codex Home → Developer Resources → Activity Stream and date_query
Activity Stream and date_query

If you have a lot of activity entries on your site, load times can suffer dramatically when viewing activity streams.

You can use the date_query argument to speed things up by limiting the entries to only those from the past day or week or month, etc.

But you cannot add it as a string in the usual fashion. For example, adding a per_page argument:

Instead, you need to use an array, which is easy enough until you try to include the value of bp_ajax_querystring( 『activity』 ) as an argument and the 『Load More』 button stops working properly.

Here』s the solution. You can paste it in your overload of the activity-loop template or you could use the bp_before_has_activities_parse_args filter.

$date_limit,
),
);

$activity_args['per_page'] = 5;

?>

// etc.

Note the use of wp_parse_str to add the query string needed for the 『Load More』 button.

And you can use conditionals to change the date_query argument depending on which activity stream you』re viewing:

?12345678910111213if ( bp_is_activity_directory() ) {     $date_limit = date("Y-m-d H:i:s", strtotime("-1 week"));      } elseif( bp_is_group() ) {     $date_limit = date("Y-m-d H:i:s", strtotime("-1 month"));      } else { // profile stream     $date_limit = date("Y-m-d H:i:s", strtotime("-1 year"));      }

BuddyPress 发布负责人和副手

BuddyPress 发布负责人和副手

Codex Home → BuddyPress Release Leads and Deputies
BuddyPress Release Leads and Deputies

The release lead works with all contributors to ensure the success of the release. The role blends aspects of being a product manager, project manager, engineering manager, release manager, and community manager. Release leads do not need to be developers, but having experience contributing to open source projects is required.
Release leads are supported by the lead developers, the project team, and deputies of their choosing. Volunteering as a release deputy is a great way to give it a try and learn about the process, but with a smaller time commitment.
For the sake of clarity, BuddyPress release leads and their deputies, between them, can expect to:

Run our weekly project meeting, and write and publish meeting notes on our development blog.
Coordinate blog posts and announcements on social media.
Make final decisions about whether a proposed feature is able to be put into the release.
Help new contributors make their contributions seen and heard in project meetings.

While BuddyPress is built by people volunteering their own time, contributing whatever they want, however they want, the release lead should take advantage of their position and use it to shape BuddyPress. For example, if the release lead feels that the next release should have a focus on specific aspects, we expect them to declare this, and try to encourage regular contributors to make that a reality.

群组管理员 – 添加自定义列

群组管理员 – 添加自定义列

Codex Home → BuddyPress Plugin Development → Groups Admin – Add Custom Column
Groups Admin – Add Custom Column

It can be very handy to see additional information about each group when viewing the Groups screen in wp-admin.

The necessary hooks are found in this file: buddypress/bp-groups/classes/class-bp-groups-list-table.php

This example will add a column to show the number of pending member requests to join each private group. If a group is public there can be no pending requests, so we』ll show a simple dash in that row.

// add the column
function groups_admin_add_custom_column( $columns ) {

$columns["pending_group_members"] = "Join Requests";

return $columns;

}
add_filter( "bp_groups_list_table_get_columns", "groups_admin_add_custom_column" );

// add the column data for each row
function groups_admin_custom_column_content( $retval = "", $column_name, $item ) {

if ( "pending_group_members" !== $column_name ) {
return $retval;
}

if ( "private" == $item["status"] ) {

$user_ids = BP_Groups_Member::get_all_membership_request_user_ids( $item["id"] );

return count( $user_ids );
}

return "-";

}
add_filter( "bp_groups_admin_get_group_custom_column", "groups_admin_custom_column_content", 10, 3 );

This code can be placed in bp-custom.php .

Twenty Seventeen 二〇一七主题

Twenty Seventeen 二〇一七主题

Codex Home → BuddyPress Theme Development → BP Theme Compatibility and the WordPress Default Themes → Twenty Seventeen Theme
Twenty Seventeen Theme

To change Twenty Seventeen』s default two-column layout to a full width layout as seen in the image above, add the following code to the `functions.php` file of your Twenty Seven child theme:
?12345678910// Remove the page-two-column CSS class from the body class in BuddyPress pagesfunction bp_remove_two_column_body_class($wp_classes) {    if( function_exists ( 'bp_loaded' ) && !bp_is_blog_page() ) :        foreach($wp_classes as $key => $value) {             if ($value == 'page-two-column') unset($wp_classes[$key]);        }    endif;    return $wp_classes;}add_filter('body_class', 'bp_remove_two_column_body_class', 20, 2);

添加电子邮件令牌

添加电子邮件令牌

Codex Home → Emails → Add Email Token
Add Email Token

Adding a token to an existing email can be done by using the bp_email_set_tokens filter.

For example, an email is sent when a member requests membership in a private group. Let』s add the requesting member』s email address to the body of that email.

function maybe_add_tokens_bp_email( $formatted_tokens, $tokens, $obj ) {

if ( isset( $formatted_tokens['requesting-user.name'] ) && isset( $formatted_tokens['requesting-user.id'] ) ) {

$user_info = get_userdata( $formatted_tokens['requesting-user.id'] );

$formatted_tokens['memberemail'] = $user_info->user_email;

}

return $formatted_tokens;

}
add_filter( 'bp_email_set_tokens', 'maybe_add_tokens_bp_email', 11, 3 );

This page lists the default tokens.

We can use that information to set the conditional so that the token is only added when a group membership request email is generated:

if ( isset( $formatted_tokens['requesting-user.name'] ) && isset( $formatted_tokens['requesting-user.id'] ) ) {
// etc

Now that we have added the memberemail token, we need to use the token in the body of the email.

Go to wp-admin > Emails and find the Membership request for group email. Roll over the name and click Edit. 

Then add the new token to the body of the email.

For example: Member Email: {{memberemail}}

Click Update and the token will be used every time that type of email is generated.

BuddyPress 案例研究

BuddyPress 案例研究

Codex Home → Getting Started → BuddyPress Case Studies
BuddyPress Case Studies

 
Twcfit – Fitness

Article: Total Wellness Challenge: Fitness with BuddyPress
Author: Tara Claeys
BuddyPress Site: Total Wellness Challenge

Nefisyemektarifleri – Turkish Recipes

Article: Largest Turkish Recipe Site Spiced Up with BuddyPress
Author: Mustafa Uysal
BuddyPress Site: NefisYemekTarifleri.com

Naturkontakt – Environmental NGO

Article: Naturkontakt, Organising Sweden』s Largest Environmental NGO
Author: Alexander Berthelsen
BuddyPress Site: Naturkontakt (private)

StudentsNepal – Education Portal

Article: Building Bridges between Students and Educators in Nepal
Author: Arjun Bhattarai
BuddyPress Site: StudentsNepal.com

PHP 版本支持

PHP 版本支持

Codex Home → Getting Started → PHP version support
PHP version support

BP supports the latest versions of PHP
BuddyPress supports all stable versions of PHP officially supported by the PHP project.
For the best security and performance, site admins are strongly encouraged to run the latest stable PHP.
BuddyPress 6.0.0 will require at least PHP 5.6
Legacy PHP support
In addition to the official supported releases, BuddyPress maintains support for a number of legacy PHP versions.
Justification for legacy support
Like WordPress, BuddyPress is meant to be easy to install and use on a large number of hosting environments. The statistics collected on wordpress.org indicate that a large number of WordPress installations continue to be hosted on out-of-date versions of PHP. (The stats breakdown for BuddyPress installations shows a similar spread.) For certain legacy versions, dropping support in a backward-incompatible way would break tens of thousands of websites. We choose not to be so strict that a majority of BP installations cannot run the software.
How we decide
At the beginning of each major development cycle (roughly three times per year), the BuddyPress team decides on the minimum PHP version that will be supported by the following major release. Thus, at the beginning of the 2.7 cycle, decisions are made about support in 2.8. This gap allows enough time for deliberation as well as for developer outreach.
The following considerations are weighed in the decision about whether to drop support for a legacy PHP version:

Usage – When a legacy version of PHP drops below a certain percentage of total installations – as gauged by the publicly available stats or by more BuddyPress-specific numbers reported by the wordpress.org team – it becomes a candidate for removal. The rule-of-thumb threshold for consideration is 5% of modern (say, 2.0+) BuddyPress installations.
Benefits – Some versions of PHP have introduced more significant features than others. If dropping support for a given version of PHP would allow for vastly improved development practices, removing support for that version will be a higher priority.

These are rough guidelines. In some cases, it may be worth obsolescing thousands of sites because the downsides of supporting the legacy version are so great. In others, the practical benefits of increasing our minimum version may be so minimal that it』s not worth breaking any sites at all.
Decisions will be made by the core team during a regularly scheduled dev chat.
What does 「support」 mean?
When we say that BuddyPress 「supports」 a version of PHP, we mean the following:

BuddyPress should run error-free (ie, without fatal errors or PHP notices) on the PHP version.
If a new version of BP includes a feature that requires a more recent version of PHP, the feature should be gracefully disabled on earlier PHP versions.
The PHP version will be included in our automated testing build matrix.

By extension: When we 「drop support」 for a legacy version of PHP, it means we stop including it in our builds, stop answering support questions related to that specific PHP version, and stop putting function_exists() checks (and the like) targeting that version when building new BP features.

过滤电子邮件

过滤电子邮件

Codex Home → Emails → Filter Emails
Filter Emails

You can filter the email fields by using the bp_email_set_tokens filter hook found in /bp-core/classes/class-bp-email.php.

For example, this will limit the BuddyPress message content to 50 words.Change 50 to whatever integer you want.

function bp_email_content_length( $formatted_tokens, $tokens, $obj ) {

$formatted_tokens['usermessage'] = wp_trim_words( $formatted_tokens['usermessage'], 50, '...' );

return $formatted_tokens;

}
add_filter( 'bp_email_set_tokens', 'bp_email_content_length', 10, 3 );