博客循环

博客循环

Codex Home → Developer Resources → Loops Reference → Blogs Loop
Blogs Loop

NOTE: This will only work with an installation of BuddyPress and WordPress MU or WordPress with multisite enabled.
The site blogs loop can be used to output a list of blogs that have been created on your installation.
Standard Loop

  • <a href="”>
    <a href="”>

    <a href="” class=”visit” title=””>

Accepted Parameters
The bp_has_blogs() function will accept a number of parameters that will manipulate the data being returned.

type optional
Defines the type of blogs to return.

Accepted arguments: active, newest, random
Default value: active

per_page optional
The number of blogs to display on a page before they are paginated to the next page.

Default value: 10

page optional
The page to return.

Default value: 1

max optional
The total number of blogs to return.

Default value: false (no limit)

user_id optional
Return only blogs that this user has higher than subscriber access to.

Default value: false

search_terms optional
Return only blogs that match these search terms.

Default value: false

上次修改 2021.12.31

群组成员循环

群组成员循环

Codex Home → Developer Resources → Loops Reference → Group Members Loop
Group Members Loop

The group members loop can be used to display members that have joined a group. It can be used nested inside the bp_has_groups() loop, or on its own with a group_id parameter.
Standard Loop

This group has no members.

Accepted Parameters
The bp_group_has_members() function will accept a number of parameters that will manipulate the data being returned.

group_id required
The ID of the group to fetch members for. Required when either: outside of the normal BuddyPress groups URL (/group/i-love-bp/members/) or not nested within a bp_has_groups() loop.

Default value: false

per_page optional
The number of members to display on a page before they are paginated to the next page.

Default value: 10

max optional
The total number of members to return.

Default value: false (no limit)

exclude_admins_mods optional
If you set this to true, only users with normal access (not a group administrator or moderator) will be returned in the members list.

Default value: true

exclude_banned optional
If you set this to true, any users that are banned from the group will not be returned in the members list.

Default value: true

Advanced Usage
Fetch all the members from the group with ID 15 and show 10 per page.

上次修改 2021.12.31

私信循环

私信循环

Codex Home → Developer Resources → Loops Reference → Private Messages Loop
Private Messages Loop

The private messages loop can be used to output a user’s private messages, both from their inbox and sentbox.
Standard Loop

There are no messages to display.

Accepted Parameters
The bp_has_message_threads() function will accept a number of parameters that will manipulate the data being returned.

user_id optional
The ID of the user to fetch messages for. By default this will be the user_id of the user currently logged in.

Default value: $bp->loggedin_user->id

box optional
Which box should the loop display messages from?

Accepted arguments: inbox, sentbox, notices
Default value: inbox

per_page optional
The number of messages to display on a page before they are paginated to the next page.

Default value: 10

max optional
The total number of messages to return.

Default value: false (no limit)

Advanced Usage
Fetch inbox messages for the user of ID 12. Get a maximum of 5 messages.

上次修改 2021.12.31

个人资料字段循环

个人资料字段循环

Codex Home → Developer Resources → Loops Reference → Profile Fields Loop
Profile Fields Loop

The profile data loop is the most complex out of all the custom BuddyPress loops. It’s actually two loops in one, the first is to loop through profile field groups, and the second to loop through profile fields in that profile field group.
Standard Loop

This user does not have a profile.

Accepted Parameters
The bp_group_has_profile() function will accept a number of parameters that will manipulate the data being returned.

profile_group_id optional
By default all groups and all fields will be displayed. If you provide the ID of a profile field group, then only the fields in this group will be displayed.

Default value: false

user_id optional
The ID of the user you want to fetch the profile data for. This is required if you are outside a member profile URL (/members/andy/…), otherwise it is the ID of the displayed user.

Default value: bp_displayed_user_id()

member_type optional
Limit fields by those restricted to a given member type, or array of  member types. If $user_id is provided, the value of $member_type will be overridden by the member types of the provided user. The special value of ‘any’ will return only those fields that are unrestricted by member type – i.e., those applicable to any type.

Default value: false

hide_empty_groups optional
By default empty groups will not be displayed. If you provide the 0 value, then all the groups will be displayed.

Default value: true

hide_empty_fields optional
By default, only show empty fields if we’re on the Dashboard, or we’re on a user’s profile edit page, or this is a registration page. If you provide the 0 value, then all the fields will be displayed on your page.

Default value: !is_network_admin() && !is_admin() && !bp_is_user_profile_edit() && !bp_is_register_page()

fetch_fields optional
Whether to fetch each group’s fields.

Default value: false

fetch_fields_data optional
Whether to fetch data for each field. Requires a $user_id.

Default value: false

exclude_groups optional
Comma-separated list or array of group IDs to exclude.

Default value: array()

exclude_fields optional
Comma-separated list or array of field IDs to exclude.

Default value: array()

update_meta_cache optional
Whether to pre-fetch xprofilemeta for all retrieved groups, fields, and data.

Default value: true

Advanced Usage
Fetch all the profile data for the user with ID 10.

Fetch the profile data for fields in the profile group ID 2 for the user with ID 10.

Fetch the profile data for fields in the profile group ID 2.

Fetch all the profile data, even empty fieds and groups, for current user.

Fetch all the profile data for the user with ID 10, excluding fields with ID 5, 6, 7.

上次修改 2021.12.31

$bp 全局

$bp 全局

Codex Home → Developer Resources → The $bp Global
The $bp Global

The $bp global contains all of the variables and configuration settings that BuddyPress needs to use throughout an installation. As a developer you may find a good first step is to use the function below to render out the contents. You’ll then be able to look over everything and get a glimpse into how things work behind the scenes.
Add this to the top of ‘bp-core.php’ and you’ll be able to take a good look at it:
function bp_dump() {
global $bp;

foreach ( (array)$bp as $key => $value ) {
echo ‘<pre>’;
echo ‘<strong>’ . $key . ‘: </strong><br />’;
print_r( $value );
echo ‘</pre>’;
}
die;
}
add_action( ‘wp’, ‘bp_dump’ );

Here’s an description of each setting:

$bp->root_components array
The slug of each component that can run in the root of the site. For example, ‘groups’ is a root component because it can run both on http://example.org/members/andy/groups but also in the root: http://example.org/groups/my-group/. Settings can be added using the function bp_core_add_root_component( $component_slug )

$bp->root_domain string
The domain of the root blog on your WPMU installation.

$bp->loggedin_user object
Contains the ID, URL and name of the currently logged in user.

$bp->loggedin_user->id The user ID of the user.
$bp->loggedin_user->domain The profile page URL of the user
$bp->loggedin_user->fullname The display name of the user

$bp->displayed_user object
If you’re looking at a user’s profile page, or any page under http://example.org/members/[username]/ then displayed_user will hold the ID, URL and name of that user. If you’re not currently looking at a user these values will return false.

$bp->displayed_user->id The user ID of the user.
$bp->displayed_user->domain The profile page URL of the user
$bp->displayed_user->fullname The display name of the user

$bp->current_component string
The slug of the component that is currently being viewed. For example on the URL http://example.org/members/andy/messages/ the current_component would be messages. On http://example.org/groups/my-group current_component would be groups. If no component is being viewed (for example on the root) then current_component will equal $bp->default_component.

$bp->current_action string
The action being carried out within a component. Current action is usually always the next parameter in the URL after $bp->current_component. For example the URL http://example.org/members/andy/messages/view/345 current_action would be view. If $bp->current_component is in the list in $bp->root_components, and we are in the root (not /members/): http://example.org/groups/my-group/join current_action would be join where as my-group would be $bp->current_item.

$bp->action_variables array
Action variables are all the remaining sections of the URL after $bp->current_action. Each section (chunks of the URL between forward slashes) become an item in the array. For example the URL http://example.org/members/andy/groups/my-groups/leave/15 the values leave and 15 would each be items in the action_variables array.

$bp->current_item string
Only used when $bp->current_component is in the list of components in $bp->root_components. If we are working in the root of the install, but within a BuddyPress component, we need to offset $bp->current_action by one, to make way for a content item. For example: http://example.org/groups/my-group/join the current_item would be my-group as it is the current content item that we are viewing. $bp->current_action would then become join. Again, this is only when working in the root, and not under the /members/ slug.

$bp->is_single_item bool
This parameter is set as true if we are viewing a single content item in the root of an installation. For example, if we are viewing a group under the URL: http://example.org/groups/my-group/ then is_single_item will be true. This forces WordPress to use the currently active BuddyPress member theme to display the content, where as it would normally have used the active WordPress theme. If you created a custom component with a URL such as: http://example.org/muffins/chocolate/ you’d want to set $bp->is_single_item to true when viewing /chocolate/, so that the BuddyPress member theme can be used to display templates.

$bp->default_component string
When the user visits http://example.org/members/[username]/ which component should be shown? This is the slug value of that component.

Default: profile

$bp->bp_nav array
This is the array used to render each component navigation menu item for the logged in user. Each component is an item of the array, which in itself is an array containing three items (listed below). You can add to this array by using the function bp_core_add_nav_item().

$bp->bp_nav[][‘name’] The display name for the component.
$bp->bp_nav[][‘link’] The URL to the main page of the component – using the currently logged in user’s profile link.
$bp->bp_nav[][‘css_id’] The CSS ID to use for the navigation item when it is rendered to the page in HTML.

$bp->bp_users_nav array
This is the array used to render each component navigation menu item for the displayed user (when you view a user that is not you). It follows the same format as $bp->bp_nav. This navigation array is different though, as it will not contain links to components that are only viewable by a logged in user (for example, messaging).

$bp->bp_users_nav[][‘name’] The display name for the component.
$bp->bp_users_nav[][‘link’] The URL to the main page of the component – using the currently displayed user’s profile link.
$bp->bp_users_nav[][‘css_id’] The CSS ID to use for the navigation item when it is rendered to the page in HTML.

$bp->bp_options_nav array
This is the array used to render all of the sub navigation items for the $bp->bp_nav array. Each item is mapped to a top level nav item via its array key. Each sub level nav item contains the same options as the top level nav items, shown below.

$bp->bp_options_nav[][‘name’] The display name for the sub-nav item.
$bp->bp_options_nav[][‘link’] The URL to the main page of the component – using the currently logged in user’s profile link.
$bp->bp_options_nav[][‘css_id’] The CSS ID to use for the navigation item when it is rendered to the page in HTML.

$bp->bp_options_title string
This is the title for the currently displayed sub-navigation item list. For example, when viewing the “Messages” component, the title of the sub-navigation item list would be “My Messages”. If we were viewing a user’s profile other than ours, the title for the sub-navigation item list would be the name of the user.

$bp->bp_options_avatar string
This is the avatar associated with the sub-navigation item list. For instance, if we are viewing a user other than the user logged in, the avatar would be that user’s avatar. If we were viewing a group, the avatar would be that group’s avatar.

$bp->grav_default string
The default setting for gravatar type, when the user has no avatar or gravatar set. This is changed in the wp-admin area under “BuddyPress > General Settings”.

$bp->is_item_admin bool
This setting can be used to give a user admin privileges on a particular piece of content. For site admins, this is always set to true, giving them override privileges on any content. For example, on the groups component, this is set to true if the currently logged in user is the creator of a group and that group is currently being viewed.

$bp->is_item_mod bool
Exactly the same as $bp->is_item_admin but for moderation privileges (basically a step down from admin privileges). This is used in the groups component for group moderators.

$bp->[component_name] object
Replace [component_name] with the name of a component and you will be able to access all of the settings for that component. Common settings for all components are listed below:

image_base The image directory for component specific images
table_name The name of the primary table used by the component
slug The URL slug for the component.
format_activity_function The function name that will format activity items into something readable by the end user.
format_notification_function The function name that will format notifications into something readable by the end user.

上次修改 2021.12.31

模板标签参考

模板标签参考

Codex Home → Developer Resources → Template Tag Reference
Template Tag Reference

This page is currently undergoing review and updating. References marked with ? have been reviewed for current accuracy.
General Template Tags

bp_get_loggedin_user_nav()
Deprecated
Uses the $bp->bp_nav global to render out the navigation within a BuddyPress install.
Each component adds to this navigation array within its own [component_name]_setup_nav() function.This navigation array is the top level navigation, so it contains items such as:
[Blog, Profile, Messages, Groups, Friends] …The function will also analyze the current component the user is in, to determine whether or not to highlight a particular nav item.
Since 1.1.0
bp_get_displayed_user_nav()
Uses the $bp->bp_users_nav global to render out the user navigation when viewing another user other than yourself.
Since 1.1.0
bp_get_options_nav()
Uses the $bp->bp_options_nav global to render out the sub navigation for the current component.
Each component adds to its sub navigation array within its own [component_name]_setup_nav() function.This sub navigation array is the secondary level navigation, so for profile it contains: [Public, Edit Profile, Change Avatar] The function will also analyze the current action for the current component to determine whether or not to highlight a particular sub nav item.@uses bp_get_user_nav() Renders the navigation for a profile of a currently viewed user.
Since 1.0.0
bp_get_options_title()
Deprecated
bp_site_name()
Returns the ‘Site Title’ set in Settings > General.
Since 1.0.0
bp_is_home()
Deprecated since 1.5. Use bp_is_my_profile() instead.
Is the current page part of the profile of the logged-in user? Will return true for any subpage of the logged-in user’s profile, e.g. http://example.com/members/joe/friends/.
bp_last_activity()
Output the “active [x days ago]” string for a user.
See bp_get_last_activity() for a description of parameters.
Since 1.0.0
bp_user_link()
Deprecated. Use bp_displayed_user_domain() instead.
bp_get_loggedin_user_link()
Get the link for the logged-in user’s profile.
Since 1.0.0
bp_loggedinuser_link()
Output the link for the logged-in user’s profile.
Since 1.2.4
bp_get_displayed_user_link()
Get the link for the displayed user’s profile.
Since 1.0.0
bp_core_get_wp_profile()
Deprecated since 1.5.0.
bp_get_profile_header()
Deprecated since 1.7.0.
bp_exists()
Deprecated since 1.7.0.
bp_format_time()
Format a date based on a UNIX timestamp.
This function can be used to turn a UNIX timestamp into a properly formatted (and possibly localized) string, useful for outputting the date & time an action took place.
Not to be confused with `bp_core_time_since()`, this function is best used for displaying a more exact date and time vs. a human-readable time.
This function may be improved or removed at a later date, as it is hardly used and adds an additional layer of complexity to calculating dates and times together with timezone offsets and i18n.
Since 1.1.0
bp_word_or_name()
Select between two dynamic strings, according to context. This will display either a word, or a name to provide better context. for example, “My friends” or “Bob’s friends”
This function can be used in cases where a phrase used in a template will differ for a user looking at his own profile and a user looking at another user’s profile (eg, “My Friends” and “Joe’s Friends”). Pass both versions of the phrase, and bp_word_or_name() will detect which is appropriate, and do the necessary argument swapping for dynamic phrases.
Since 1.0.0
bp_get_plugin_sidebar()
Deprecated since 1.7.0.
This will try and find the file plugin-sidebar.php and display it if it’s found.
bp_is_page()
Deprecated since 1.7.0.
bp_is_blog_page()
Is this a blog page, ie a non-BP page?
You can tell if a page is displaying BP content by whether the current_component has been defined.
True if it’s a non-BP page, false otherwise.
Since 1.0.0
bp_page_title()
Deprecated since 1.5.0. Use wp_title()
bp_get_page_title()
Deprecated since 1.5.0. Use wp_title()
bp_styles()
Deprecated
bp_has_custom_signup_page()
Do we have a working custom sign up page?
True if page and template exist, false if not.
Since 1.5.0
bp_signup_page()
Output the URL to the signup page.
Since 1.0.0
bp_has_custom_activation_page()
Do we have a working custom activation page?
True if page and template exist, false if not.
Since 1.5.0
bp_activation_page()
Output the URL of the activation page.
Since 1.0.0
bp_search_form()
Deprecated since 1.1.0.
bp_search_form_action()
Return the “action” attribute for search forms.
Since 1.0.0
bp_search_form_type_select()
bp_login_bar() Removed/deprecated
bp_profile_wire_can_post()
This is deprecated, for more info, see the BuddyPress Backwards Compatibility plugin. Deprecated
bp_nav_items()
Deprecated This is deprecated, you should put these navigation items in your template header.php for easy editing.
bp_custom_profile_boxes()
Deprecated
bp_custom_profile_sidebar_boxes()
Deprecated
bp_get_userbar()
Deprecated
bp_get_optionsbar()
Deprecated
bp_is_directory()
Is this a component directory page?
True if the current page is a component directory, otherwise false.
Since 1.0.0
bp_create_excerpt()
Cuts a string to the length of $length and replaces the last characters with the ending if the text is longer than length.
This function is borrowed from CakePHP v2.0, under the MIT license. See http://book.cakephp.org/view/1469/Text#truncate-1625
Since 1.0.0
Fakes an excerpt on any content. Will not truncate words.
bp_is_serialized()
Checks to see if the data passed has been serialized.
bp_rewind_site_members
bp_has_site_members
bp_the_site_member
bp_site_members
bp_site_members_pagination_count
bp_get_site_members_pagination_links
bp_site_members_pagination_links
bp_get_the_site_member_user_id
bp_the_site_member_user_id
bp_get_the_site_member_avatar
bp_the_site_member_avatar
bp_get_the_site_member_link
bp_the_site_member_link
bp_get_the_site_member_name
bp_the_site_member_name
bp_get_the_site_member_last_active
bp_the_site_member_last_active
bp_get_the_site_member_registered
bp_the_site_member_registered
bp_the_site_member_add_friend_button
bp_get_the_site_member_total_friend_count
bp_the_site_member_total_friend_count
bp_the_site_member_random_profile_data
bp_the_site_member_hidden_fields
bp_directory_members_search_form
bp_home_blog_url

BP Member/User tags
bp_displayed_user_id()
bp_current_user_id()
bp_loggedin_user_id()
bp_core_get_user_domain() returns url to user account given a user id ‘bp_loggedin_user_id’
bp_core_get_userlink() returns a fully rendered link to users account

bp_displayed_user_domain()
bp_loggedin_user_domain()
bp_user_fullname()
bp_displayed_user_fullname()
bp_get_loggedin_user_fullname()
bp_loggedin_user_fullname()

BP Component & Action checks

bp_current_component()
bp_current_action()
bp_action_variables()

Avatar Template Tags

bp_has_options_avatar()
Check to see if there is an options avatar. An options avatar is an avatar for something
like a group, or a friend. Basically an avatar that appears in the sub nav options bar.
bp_get_options_avatar()
bp_comment_author_avatar()
bp_post_author_avatar()
bp_loggedin_user_avatar()
bp_get_loggedin_user_avatar()
bp_displayed_user_avatar()
bp_get_displayed_user_avatar()
bp_avatar_admin_step()
bp_get_avatar_admin_step()
bp_avatar_to_crop()
bp_get_avatar_to_crop()
bp_avatar_to_crop_src()
bp_get_avatar_to_crop_src()
bp_avatar_cropper()

Signup Template Tags

bp_signup_username_value
bp_get_signup_username_value
bp_signup_email_value
bp_get_signup_email_value
bp_signup_with_blog_value
bp_get_signup_with_blog_value
bp_signup_blog_url_value
bp_get_signup_blog_url_value
bp_get_signup_blog_title_value
bp_signup_blog_title_value
bp_get_signup_blog_privacy_value
bp_signup_blog_privacy_value
bp_get_signup_avatar_dir_value
bp_signup_avatar_dir_value
bp_get_current_signup_step
bp_current_signup_step
bp_get_signup_avatar
bp_signup_avatar

Section under review/editing see below for more up to date references.
is_ functions
These is_ functions are used to determine the type of page currently being served within the template.

bp_is_user()
Used to determine if the current page is a user page.
Returns:
TRUE if current page is a user page
FALSE otherwise

bp_is_user_profile()Used to determine if the current page is a profile screen.

Returns:
TRUE if current page is a profile page
FALSE otherwise

bp_is_activity()Used to determine if the current page is the activity page.

Returns:
TRUE if current page is the activity page
FALSE otherwise

bp_is_blogs()Used to determine if the current page is the blogs page.

Returns:
TRUE if current page is the blogs page
FALSE otherwise

bp_is_wire()Used to determine if the current page is a wire page.

Returns:
TRUE if current page is a wire page
FALSE otherwise

bp_is_messagesUsed to determine if the current page is a messages page.

Returns:
TRUE if current page is a messages page
FALSE otherwise

bp_is_friends()Used to determine if the current page is a friends page.

Returns:
TRUE if current page is a friends page
FALSE otherwise

bp_is_group()Used to determine if the current page is the groups page.

Returns:
TRUE if current page is the groups page
FALSE otherwise

bp_is_settings_componentUsed to determine if the current page is the user settings page.

Returns:
TRUE if current page is the user settings page page
FALSE otherwise

bp_is_my_activityUsed to determine if the current page is the my activity page.

Returns:
TRUE if current page is the my activity page
FALSE otherwise

bp_is_friends_activity()Used to determine if the current page is a friends activity page.

Returns:
TRUE if current page is a friends activity page
FALSE otherwise

bp_is_profile_edit()Used to determine if the current page is the profile edit page.

Returns:
TRUE if current page is the profile edit page
FALSE otherwise

bp_is_change_avatar()Used to determine if the current page is the change avatar page.

Returns:
TRUE if current page is the change avatar page
FALSE otherwise

bp_is_group_single()Used to determine if the current page is a single group page.

Returns:
TRUE if current page is a single group page
FALSE otherwise

bp_is_group_home()Used to determine if the current page is a group homepage.

Returns:
TRUE if current page is a group homepage
FALSE otherwise

bp_is_group_create()Used to determine if the current page is a group create page.

Returns:
TRUE if current page is a group create page
FALSE otherwise

bp_is_group_admin_page()Used to determine if the current page is a group admin page.

Returns:
TRUE if current page is a group admin page
FALSE otherwise

bp_is_group_forum()Used to determine if the current page is a group forum page.

Returns:
TRUE if current page is a group forum page
FALSE otherwise

bp_is_group_forum_topic()Used to determine if the current page is a group form topic page.

Returns:
TRUE if current page is a group forum topic page
FALSE otherwise

bp_is_group_membersUsed to determine if the current page is a group members page.

Returns:
TRUE if current page is a group members page
FALSE otherwise

bp_is_group_invites()Used to determine if the current page is a group invite page.

Returns:
TRUE if current page is a group invite page
FALSE otherwise

bp_is_group_leave()Used to determine if the current page is a ’leave the group’ page.

Returns:
TRUE if current page is a ’leave the group’ page
FALSE otherwise

bp_is_my_blogsUsed to determine if the current page is the my blogs page.

Returns:
TRUE if current page is the my blogs page
FALSE otherwise

bp_is_create_blog()Used to determine if the current page is the ’create a blog’ page.

Returns:
TRUE if current page is ’create a blog’ page
FALSE otherwise

bp_is_friends_screen()Used to determine if the current page is the friends page.

Returns:
TRUE if current page is the friends page
FALSE otherwise

bp_is_friend_requests()Used to determine if the current page is the friend requests page.

Returns:
TRUE if current page is the friend requests page
FALSE otherwise

bp_is_messages_inbox()Used to determine if the current page is the messages inbox page.

Returns:
TRUE if current page the messages inbox page
FALSE otherwise

bp_is_messages_sentbox()Used to determine if the current page is the messages sentbox page.

Returns:
TRUE if current page is the messages sentbox page
FALSE otherwise

bp_is_messages_conversation()Used to determine if the current page is a single messages conversation.

Returns:
TRUE if the current page is a single messages thread
FALSE otherwise

bp_is_notices()Used to determine if the current page is the notices page.

Returns:
TRUE if current page is the notices page
FALSE otherwise

bp_is_messages_compose_screen()Used to determine if the current page is the message compose page.

Returns:
TRUE if current page is the message compose page
FALSE otherwise

bp_is_register_page()Used to determine if the current page is the registration page.

Returns:
TRUE if current page is the registration page
FALSE otherwise

bp_is_activation_page()Used to determine if the current page is the activation page.

Returns:
TRUE if current page is the activation page
FALSE otherwise

Conditional template tags allow you to show specific content on specific pages. The following tags are available in BuddyPress (1.2+):

is_buddypress()
A generic check for buddypress screens.

Returns:
TRUE if current screen is a BP one
FALSE otherwise

bp_is_user()
Used to determine if the current page is a user page.

Returns:
TRUE if current page is a user page
FALSE otherwise

bp_is_user_profile()
Used to determine if the current page is a profile screen.

Returns:
TRUE if current page is a profile page
FALSE otherwise

bp_is_my_profile()
Used to determine if this is a profile component screen

Returns:
TRUE if current page is a profile page
FALSE otherwise

bp_is_blog_page()
A catch all for a WP blog page in BP.

bp_is_directory()
bp_is_serialized($data) – checks to see if $data is serialized
bp_is_front_page()
bp_is_activity_front_page()
bp_is_page($page) // deprecated 1.7 use bp_is_current_component( ‘activity’ )
bp_is_current_component( ‘activity’ ) ?
bp_is_active( $component ) – checks if a BP $component is active ?
bp_is_profile_component()
bp_is_activity_component()
bp_is_blogs_component()
bp_is_messages_component()
bp_is_friends_component()
bp_is_groups_component()
bp_is_settings_component()
bp_is_user_activity()
bp_is_user_friends_activity()
bp_is_activity_permalink() // deprecated 1.5 use bp_is_single_activity()
bp_is_user_profile()
bp_is_profile_edit()
bp_is_change_avatar()
bp_is_user_groups()
bp_is_group()
bp_is_group_home()
bp_is_group_create()
bp_is_group_admin_page()
bp_is_group_forum()
bp_is_group_activity()
bp_is_group_forum_topic()
bp_is_group_forum_topic_edit()
bp_is_group_members()
bp_is_group_invites()
bp_is_group_membership_request()
bp_is_group_leave()
bp_is_group_single()
bp_is_user_blogs()
bp_is_user_recent_posts()
bp_is_user_recent_commments()
bp_is_create_blog()
bp_is_user_friends()
bp_is_friend_requests()
bp_is_user_messages()
bp_is_messages_inbox()
bp_is_messages_sentbox()
bp_is_notices()
bp_is_messages_compose_screen()
bp_is_single_item()
bp_is_activation_page()
bp_is_register_page()
If you wanted to see if this was a single group page, in your template you could do:
Show this on group home pages
Or if you wanted to show something on every single group page, regardless if it was the home page or not:
Show this on all single group pages
There are no specific checks on group names etc yet, but you can do this:
This is my-group

上次修改 2021.12.31

常见问题(FAQ)

常见问题(FAQ)

Codex Home → Legacy Docs → Archived Section: Getting Started → FAQ
FAQ

Archived file. Good only up to BP 1.5 version

Where can I track BuddyPress development?

Ask a question on the forums
Report bugs and view patches on the BuddyPress Trac server
Join the #buddypress-dev IRC room on Freenode.
Check out the BuddyPress Development Updates blog and the official BuddyPress blog
Follow development updates on Twitter – @buddypressdev
Join the Public Mailing List

What version of WordPress should I run?
WordPress 3.4+. Though it’s advised to run the latest stable version of WordPress to ensure you’re site is fully secure.
Is BuddyPress a forum script?
BuddyPress is a social networking plugin for WordPress. It is not a forum script. A stripped-down forum used to be provided for BP groups using bbPress however when bbPress was re-written to be a standalone plugin it was decided to remove the inbuilt groups forums in versions of BP from 1.7 onwards as bbPress supports them but also gives a far richer forum experience. BuddyPress Groups component. However, if you are looking for a traditional forum (setting up forum categories, forum administration, etc.), you can try the bbPress forum plugin.
Can I run BuddyPress on a Windows server?
Yes.
Where do I report bugs?
Head to: https://trac.buddypress.org/newticket please sign in with your WordPress.org username and password (sign up here)
Can BuddyPress authenticate via LDAP?
Yes. You will need to install a WordPress LDAP login plugin first of all though, then add define( ‘BP_ENABLE_USERNAME_COMPATIBILITY_MODE’, true ); to your wp-config.php file.
Can I run multiple instances of BuddyPress in a WP Multisite installation?
No. BuddyPress can only be activated once in either the main site or a secondary blog of a WP Multisite installation.  For WP multi-networks, try the approach listed in this post.
Registration
I don’t see the register button on my BuddyPress site!
Login to the WP admin area, navigate to “Settings > General”, and make sure “Anyone can register” is checked.
If you’re using WordPress in network mode, login to the WP admin area, navigate to “Super Admin > Options”, and under “Allow new registrations”, select any option but “Disabled”.
BuddyPress isn’t sending out emails (eg. activation emails, email notifications)
This appears to be a problem with certain web hosts (Bluehost primarily).
Members of the BP community have had success using:

Mail From Plugin
WP Mail SMTP Plugin
Configure SMTP Plugin

WP Mail SMTP and Configure SMTP can send a test email which often provides useful debug information. Check also with your webhost’s tech support for more information.
Activity Stream
BP 1.2 Default Theme – Set the Activity Stream as front page, blog posts on another page
1) Login to the WP backend, navigate to “Pages > Add New”. Create an empty, new page called “News” or “Blog” or whatever you want. This page will contain the blog updates.
2) Under “Settings > Reading”, set front page to “Activity Stream” and your posts page to the new page that you just created.
How do I disable activity stream comments for blog and forum posts?
1) Login to the WP backend, navigate to “Buddypress > General settings”.
2) Under “Disable activity stream commenting on blog and forum posts?” Select “Yes”.
Extending BuddyPress
Is there a compatible Facebook Connect plugin for BuddyPress?
Yes there is. Try WP-FB-AutoConnect.
Make sure under WP-FB-AutoConnect’s settings, to uncheck “Disable BuddyPress Filters”.
Avatars
Why can’t I upload avatars on my server?
This could be a number of things, but make sure you have the GD image library installed.   It might also be permissions, so make sure the web server has correct permissions.

上次修改 2021.12.31

创建自定义组件

创建自定义组件

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.

上次修改 2021.12.31

语言和翻译

语言和翻译

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.

上次修改 2021.12.31

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.

上次修改 2021.12.31