视频 (Videos)

视频 (Videos)

Codex Home → Getting Started → Videos
Videos

Herding Cats with the BuddyPress Activity Component
BuddyPress is great for building niche community sites. But, in the hands of the right developer, BP can power much more than just social networks. The Activity component is a prime example of this flexibility.

BuddyPress Rules – The Road To Rewrites Is Paved With Pretty Permalinks
This session discusses how WordPress Rewrite Rules API integration for BuddyPress 1.8 was planned, architected, built, and patched.

Beyond the Default: Explorations and Experiments in BuddyPress
For years BuddyPress was tied to a specific theme and creating a custom theme had a steep learning curve. BuddyPress now has theme independence. This presentation looks beyond the default, to new UI』s, new possibilities.

BuddyPress 101
This is an introduction into the use of BuddyPress on an existing WordPress-powered web site. NOTE: this video may be of an earlier version of BuddyPress.

Advanced BuddyPress Plugin Development

Beyond the Blog with BuddyPress and bbPress
This presentation showcases some favorite BuddyPress and bbPress installations. It explains what makes them great, why they』ve succeeded, and provides tips and tricks you can implement to take your BuddyPress and bbPress powered site far beyond the blog.

已弃用的指南

已弃用的指南

Codex Home → Getting Started → User Submitted Guides → Deprecated Guides
Deprecated Guides

Pages in this section represent older code and functions that are no longer current and have been deprecated in the core BP plugin.
Generally there will be newer alternative methods to replace these deprecated ones.
These guides are preserved for backwards compatibility as deprecated code may still be in use and the guides here of some relevance and usefulness.

移动设备 (Mobile)

移动设备 (Mobile)

Codex Home → Mobile
Mobile

BuddyPress should work on most mobile smartphone browsers in the same manner it works on desktop browsers. However, you can optimize the mobile experience in a few different ways.
Responsive Themes
Responsive web design or responsive themes are themes that shift its layout depending on the available screen size of the device someone has used to access a site. This makes the viewing experience greatly improved with minimal panning, zooming and scrolling.
BuddyPress works on most themes out of the box even with responsive themes. That being said, the template files for BuddyPress are not 100% responsive. Since every theme has it』s own varying CSS there would be no way to force a set responsiveness to the BuddyPress template files for every available theme. You can always add your own template files and CSS to BuddyPress to enhance the responsiveness.
There are many free and paid responsive WordPress themes available to install.
Web Apps
Web apps are applications that use a web browser as the client and are not installed locally. This has the advantage of supporting more devices especially when most smartphone mobile browsers support current advancements in web technology.
One of the characteristics of web apps is that there are no full page refreshes making it seem like everything happens in one window with a snappier response. Data is generally accessed from a REST API and then a javascript based web app updates the browser with returned data. BuddyPress currently has no official mobile web apps.
Mobile Plugins
There are a handful of WordPress plugins to switch out your theme to a fully responsive/web app type theme. These can be the best and easiest solution to format your site on the myriad of available devices. BuddyPress currently has no official mobile theme plugins.
Mobile Plugins:

WPTouch: 3rd Party Developer  https://wordpress.org/plugins/wptouch
BuddyMobile: 3rd Party Developer https://wordpress.org/plugins/buddymobile
Jetpack Mobile Theme: Automattic https://wordpress.org/plugins/jetpack
AppPresser: 3rd Party Developer https://wordpress.org/plugins/apppresser

Native Apps
Native apps are installed locally per device. Normally you would visit an App Store from one of the mobile OS venders to install apps. If you were to create a mobile app you would need to create a different native app for each smartphone vendor just like the mobile apps for WordPress. This can be seen as disadvantages for developers. BuddyPress currently has no official native apps.
Native Mobile Apps:

BuddyDroid: 3rd Party Developer https://play.google.com/store/apps/details?id=org.yuttadhammo.buddydroid

BuddyPress API
BuddyPress currently has no official API for external communication. There are a few 3rd Party API plugins. These may not be up to date or working. Use at your own discretion.
API Plugins:

JSON API for BuddyPress: 3rd Party Developer https://wordpress.org/plugins/json-api-for-buddypress
BuddyData: 3rd Party Developer https://github.com/modemlooper/BuddyData
BuddyPress API: 3rd Party Developer https://github.com/boonebgorges/buddypress-api

使用 bp_parse_args() 过滤 BuddyPress 模板循环

使用 bp_parse_args() 过滤 BuddyPress 模板循环

Codex Home → Developer Resources → Using bp_parse_args() to filter BuddyPress template loops
Using bp_parse_args() to filter BuddyPress template loops

Prologue
In the past, it has been extremely difficult to filter any BuddyPress template loop.
For example, let』s say I wanted all activity loops to show the last five entries instead of the default of 20. It was possible, but basically you』d either have to requery the activity loop to grab the last five entries and override the 'bp_has_activities' filter or override the activity SQL statement using the 'bp_activity_paged_activities_sql' filter.
Both methods are totally not cool.
Introducing bp_parse_args()!
The introduction of the bp_parse_args() function in BuddyPress 2.0 makes this way simpler. Let』s take a look at the bp_has_activities() loop with the bp_parse_args() function:
https://buddypress.trac.wordpress.org/browser/tags/2.0/bp-activity/bp-activity-template.php#L525
Once you』ve analyzed that a bit, let』s move on to the specific usage of bp_parse_args() in the bp_has_activities() loop:
?1$r = bp_parse_args( $args, $defaults, 'has_activities' );
In particular:

The first argument, $args, are the parameters for the activity loop initially passed by bp_has_activities().
The second argument, $defaults, are some default parameters for the activity loop that are used if the $args variable does not contain them.
The third argument, 'has_activities', is a unique identifier used for this instance of bp_parse_args(). More on this later.

Now that you know how bp_parse_args() is used in bp_has_activites(), let』s analyze the bp_parse_args() function and how we can use this to our advantage.
bp_parse_args() in depth
The bp_parse_args() function can be found here:
https://buddypress.trac.wordpress.org/browser/branches/2.0/bp-core/bp-core-functions.php#L205
In this function, there are two filters:

'bp_before_{$filter_key}_parse_args' – Allows you to filter the initial arguments, $args.
'bp_after_{$filter_key}_parse_args' – Allows you to filter the arguments after $args has been merged with $defaults.

You』re probably wondering what $filter_key is. $filter_key is the third argument from bp_parse_args().
In our case, it is 'has_activities'.
So if I wanted to filter the activity loop parameters, the filters would look like this:

'bp_before_has_activities_parse_args'
'bp_after_has_activities_parse_args'

Now that we』ve taken a look at the bp_parse_args() function and how it applies filters to the arguments. Let』s actually write our override filter!
Filtering bp_parse_args()
Let』s go back to the original issue. I want to filter all activity loops to show only the last five entries instead of the default of 20.
Using the 'bp_after_has_activities_parse_args' filter that we』ve determined above, let』s write our override function:
?1234567// Fetch only the last five entries for all activity loopsfunction my_bp_activities_per_page_5( $retval ) {    $retval['per_page'] = 5;     return $retval;}add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_per_page_5' );
So what did we just do? We』re overriding the 'per_page' parameter so only the last five entries are fetched instead of the default of 20. It』s as simple as that!
Note that this overrides all activity loops across BuddyPress. What if I only wanted to fetch the last five entries only on a user』s activity page? Easy, just add your conditionals:
?123456789function my_bp_activities_per_page_5_on_user_activity( $retval ) {    // only fetch the last five entries if we're on a user's activity page    if ( bp_is_user_activity() ) {        $retval['per_page'] = 5;    }     return $retval;}add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_per_page_5_on_user_activity' );
You can get uber-creative by filtering all the other parameters in the activity loop:
https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-activity/bp-activity-template.php#L442
Conclusion
Now that you know how to use the bp_parse_args() function, you should be able to easily filter any BuddyPress template loop!
For convenience, here are the other template loops using bp_parse_args():

Blogs – https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-blogs/bp-blogs-template.php#L366
Groups – https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-groups/bp-groups-template.php#L431
Members – https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-members/bp-members-template.php#L461
Message Threads – https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-messages/bp-messages-template.php#L372
Notifications – https://buddypress.trac.wordpress.org/browser/tags/2.2.1/src/bp-notifications/bp-notifications-classes.php#L556
XProfile – https://buddypress.trac.wordpress.org/browser/tags/2.0/bp-xprofile/bp-xprofile-template.php#L169

在 WordPress 多站点中安装

在 WordPress 多站点中安装

Codex Home → Getting Started → Installation in WordPress Multisite
Installation in WordPress Multisite

Before installing BuddyPress, please make sure that you』ve checked the minimum server requirements and WordPress version compatibility.
You can install BuddyPress in your Network (multisite) in either of the following setups.
Network-wide
A. BuddyPress root blog in Main Site
B. BuddyPress root blog in Secondary Site
One site of the Network
C. BuddyPress Activated in Main Site only
D. BuddyPress Activated in Secondary Site only
Posts, comments, or activities of the users in sites other than where you activated BuddyPress won』t be recorded in the Activity Streams when you install BuddyPress in only one site of the network.
Special Setups
E. BP_ENABLE_MULTIBLOG – network activated
F. BuddyPress Multisite – network activated
A. Network-wide Activation – BuddyPress root blog in Main Site

Go to Dashboard → Network Admin.
Add BuddyPress through Plugins → Add New.
Activate BuddyPress.
Configure BuddyPress for Multisite.

B. Network-wide Activation – BuddyPress root blog in Secondary Site

Go to Dashboard → Network Admin.
Click on Sites link.
Find the ID number of the site you want to be the root site of your BuddyPress installation.
Open up your installation』s wp-config.php file.
Add
define ( 'BP_ROOT_BLOG', $blog_id );
to your wp-config.php file where $blog_id is the ID number of your chosen site and save the file.
Go to Dashboard → Network Admin.
Add BuddyPress through Plugins → Add New.
Activate BuddyPress. You will be redirected to the BuddyPress Welcome screen.
Configure BuddyPress for Multisite.

C. Activate BuddyPress in the Main Site of the Network only

Go to Dashboard → Network Admin.
Add BuddyPress through Plugins → Add New.
Proceed to the Dashboard of the Main Site.
Navigate to Plugins → Plugins .
Activate BuddyPress. You will be redirected to the BuddyPress Welcome screen.
Configure BuddyPress.

D. Activate BuddyPress in only one of the Secondary Sites of the Network

Go to Dashboard → Network Admin.
Click on Sites link.
Find the ID number of the site you want to be the root site of your BuddyPress installation.
Open up your installation』s wp-config.php file.
Add
define ( 'BP_ROOT_BLOG', $blog_id );
to your wp-config.php file where $blog_id is the ID number of your chosen site and save the file.
Go to Dashboard → Network Admin.
Add BuddyPress through Plugins → Add New.
Navigate to the subsite which you identified in your wp-config.php file earlier
Activate BuddyPress. You will be redirected to the BuddyPress Welcome screen.
Configure BuddyPress.

F. BuddyPress MultiSite
This extends BuddyPress network instance from one site or subsite to multiple BuddyPress instances in a WordPress Multisite installation. This setup is complicated and would require BuddyPress/WordPress expertise plus server administration skills. You would need to install plugins to be able to configure this set up such as:
– BP Multi Network (WordPress plugin repository) or
– BuddyPress Multi Network (BuddyDev.com)
Please post in the respective forums if you would need assistance with either.

⇒ Next: Configure BuddyPress
or
⇒ Next: Configure BuddyPress for Network-wide set ups
⇐Previous: Getting Started

网站礼仪规则

网站礼仪规则

Codex Home → Site Etiquette
Site Etiquette

What follows are the 「rules of etiquette」 for BuddyPress.org, and can be summed up as 「being cool」 which is a good way to be anyhow, particularly if you appreciate the Fonz.
1. Be cool. This means respect the other users of this site and mind what you say. If you wouldn』t walk into your grandmothers house and say to her bridge club what you feel you want to say here, probably filter it down and sensor yourself just a smidge. Not that we can』t take the heat (or gramma can』t either), but it just isn』t productive.
2. Stay on topic. Naturally conversations die off and people run out of things to say. When that happens, hop onto your activity stream and start shouting to the world there instead. The forums are explicitly for supporting and helping develop BuddyPress, and anything else gets in the way of that.
3. Moderators on duty. If things get out of hand, we have a volunteer staff of gentle giants that can still be angered. They』re like hybrid Terminator/Frankenstein/Zombies that, while kind and mild mannered, are chomping at the bit to mark you as a spammer.
4. Do not feed the animals. If someone is bullying you or someone else around or just starting fires randomly, ignore them and ping one of the moderators. These forums are meant to be fun for people of all ages and skill levels; so be kind, rewind.
5. No put downs. Or else you won』t get milk at lunch. If you do get milk, and if the arrow on your carton is pointing at someone, that means you love them. And yes, if it』s pointing at yourself, that means you love yourself.
We want everyone to feel welcome, comfortable, and appreciated. In order to do that it seems we』ve gotten to the point where it will pay to have some loose rules to refer people to if things go awry. If you do your best to follow this guide, there will be cake.