创建自定义组件

创建自定义组件

Codex Home → Legacy Docs → Archived Section: Plugin Development → Creating a Custom Component
Creating a Custom Component

Note: If you are building a BuddyPress plugin, please make sure you have read how to check if BuddyPress is active. This is very important – the code you need is included in v1.4 of the skeleton component.
If you』re going to develop your own custom BuddyPress component then a great starting point is the 「Skeleton Component「. This is a bare-bones component that will provide a solid starting block for you to develop your component from.

核心 (Core)

核心 (Core)

Codex Home → Developer Resources → Action Reference → Core
Core

bp-core.php

bp_core_render_notice
bp_core_clear_cache

bp-core/bp-core-activation.php

activate_header
bp_activation_extras

bp-core/bp-core-adminbar.php

bp_adminbar_logo
bp_adminbar_menus

bp-core/bp-core-ajaxhandler.php

wp_ajax_[post action]

bp-core/bp-core-avatars.php

bp_core_render_avatar_cropper
bp_core_avatar_save (removed since BP 1.2)
bp_core_render_avatar_upload_form
bp_core_delete_avatar

bp-core/bp-core-settings.php

bp_notification_settings

bp-core/bp-core-signup.php

signup_header
signup_blogform
signup_extra_fields
signup_hidden_fields
signup_finished
preprocess_signup_form

bp-core/bp-core-templatetags.php

bp_styles
bp_custom_profile_boxes
bp_custom_profile_sidebar_boxes

bp-core/directories/bp-core-directory-members.php

bp_core_directory_members_content
bp_core_directory_members_sidebar

语言和翻译

语言和翻译

Codex Home → Languages and Translations
Languages and Translations

Like WordPress, BuddyPress has the built in capability to be used in any language. The instructions below assume you have already configured WordPress in Your Language and Installing WordPress in Your Language.
Like WordPress, you don』t have to lift a finger to apply BuddyPress translations or translation updates. Most sites are now able to automatically apply these updates in the background. If your site is capable of one-click updates without entering FTP credentials, then your site should be able to automatically update translations.
Official BuddyPress translation files (buddypress-xx_XX.po/mo) are loaded to wp-content/languages/plugins/.
Note: the buddypress.pot file provided with each new update is not a translation, but only the translatable strings catalog.
Is your language missing?
BuddyPress translation packages are only updated if the translation is at 100% translated, if you do not see your language after updating your translations, please consider contributing to the the BuddyPress translation project, to get started see Translating WordPress and post any questions you have on the WordPress Polyglots blog.
Manually overriding the translations
1. Get latest (stable) version of BuddyPress and dev
Go to https://translate.wordpress.org/projects/wp-plugins/buddypress and select your preferred language e.g. Portuguese (Brazil)
Select 'Stable (latest release)' or 'Development (trunk)'.
Select 'all current' as '.po' and click 『Export』 and save this file to a folder on your computer, do the same again this time selecting '.mo'
Rename each file to buddypress-language_COUNTRY.extension
eg.
wp-plugins-buddypress-stable-pt-br.po to buddypress-pt_BR.po and
wp-plugins-buddypress-stable-pt-br.mo to buddypress-pt_BR.mo
2. How to use custom language files
You can use your own translation version to fit your needs. Add it to /wp-content/languages/buddypress/. This new directory will not be automatically updated, so it is a safe place to store your custom work. BuddyPress will check for this directory as first. If nothing is found, it will use the translation stored wp-content/languages/plugins/. You can use both directories, so you will never miss an official translation and continue to use your own one. Simply remind to control your work after each BuddyPress update, with help of the buddypress.pot file.
Upload as described or copy the translation files from wp-content/languages/plugins/ to /wp-content/languages/buddypress/.
To create or modify a custom translation you need to use a translation tool, like poEdit or similar, to generate a compiled .mo file.
If the /wp-content/languages/ or /wp-content/languages/plugins/ or /wp-content/languages/buddypress/ folders do not exist, create them.
Using FTP upload both the .po and .mo files to of your WordPress installation.

博客 (Blogs)

博客 (Blogs)

Codex Home → Developer Resources → Action Reference → Blogs
Blogs

bp-blogs.php

bp_blogs_screen_my_blogs
bp_blogs_screen_recent_posts
bp_blogs_screen_recent_comments
bp_blogs_screen_create_a_blog
bp_blogs_format_activity
bp_blogs_new_blog
bp_blogs_new_blog_post
bp_blogs_new_blog_comment
bp_blogs_remove_blog
bp_blogs_remove_blog_for_user
bp_blogs_remove_post
bp_blogs_remove_comment
bp_blogs_remove_data_for_blog
bp_blogs_remove_data

bp-blogs/directories/bp-blogs-directory-blogs.php

bp_blogs_directory_blogs_content
bp_blogs_directory_blogs_sidebar

Simplified Chinese (zh_CN)

Simplified Chinese (zh_CN)

Codex Home → Languages and Translations → Simplified Chinese (zh_CN)
Simplified Chinese (zh_CN)

This page needs to be updated. Link below leads to a page linking to the Chinese section which has not been updated since 2010.

WordPress Chinese Group – ——
Download it at:
Dreamcolor』s Cote

The PO and MO files are already for the last stable. So they will been updateed any time. But you can find newest zip file on the download page.

好友 (Friends)

好友 (Friends)

Codex Home → Developer Resources → Action Reference → Friends
Friends

bp-friends.php

friends_screen_my_friends
friends_screen_requests
friends_screen_friend_finder
friends_screen_notification_settings
friends_format_activity
friends_format_notifications
friends_friendship_requested
friends_friendship_deleted
friends_friendship_accepted
friends_friendship_rejected
friends_remove_data

bp-friends/bp-friends-templatetags.php

friends_header_tabs

提高性能

提高性能

Codex Home → Getting Started → Improving Performance
Improving Performance

Due to the highly dynamic nature of social networks, without caching BuddyPress will add extra load on your server.
Thankfully, there are lots of options for increasing the performance of your server that take very little time to set up.
Reduce Database Hits
With many different content objects on each page, BuddyPress needs to pull a wide range of content from the database. The number of hits to the database is always a consideration and has been kept to a minimum where possible.
An excellent way to reduce the number of database hits per page even further is to turn on the persistent cache in the form of object caching.
To do this you will need to add: define( 'WP_CACHE', true ); into your wp-config.php file above the 「stop editing」 line.
You will then need to choose the type of persistent caching you would like to use. The most notable options are file based, memcached. If you』re unsure go with the file based caching.

File based
Memcached

You will need to make sure you have object-cache.php in your wp-content directory and a writable wp-content/cache/ directory for file based caching.
Reduce Memory Usage
An excellent way to significantly reduce memory usage is to install op-code caching on your server. There are two well known:

eAccellerator
XCache

Tweak Your Server
Tweaking your server settings can have a huge impact on performance. Even the smallest of adjustments can yield impressive results. Here are some articles that you may find helpful:

WP Codex: WordPress Optimization
WordPress optimization guide

Please feel free to edit this page and add any tactics you have found that increase your hardware performance.

核心组件

核心组件

Codex Home → Developer Resources → Function Examples → Core Component
Core Component

Core component functions can be used by any official component, add-on component, WordPress or BuddyPress plugin. The core is always required, so you can be sure that the functions are always present.