更改内部配置设置

更改内部配置设置

Codex Home → Getting Started → Customizing → Changing Internal Configuration Settings
Changing Internal Configuration Settings

N.B: This article lists deprecated settings as well as current ones
 
There are many internal configuration settings that can be changed by adding a configuration definition line to your wp-content/plugins/bp-custom.php file or use a filter if available. Here』s a list of the current configurations that can be changed:
 
Avatar Configurations
Avatar specific settings can be changed:
define ( 'BP_AVATAR_THUMB_WIDTH', 50 );
define ( 'BP_AVATAR_THUMB_HEIGHT', 50 );
define ( 'BP_AVATAR_FULL_WIDTH', 150 );
define ( 'BP_AVATAR_FULL_HEIGHT', 150 );
define ( 'BP_AVATAR_ORIGINAL_MAX_WIDTH', 640 );
define ( 'BP_AVATAR_ORIGINAL_MAX_FILESIZE', $max_in_kb );
define ( 'BP_AVATAR_DEFAULT', $img_url );
define ( 'BP_AVATAR_DEFAULT_THUMB', $img_url );

 
Cover Image Configurations
To customize cover images please visit this link: https://codex.buddypress.org/themes/buddypress-cover-images/
 
Advanced Configurations
Put profiles in the root — http://example.org/username/
define ( 'BP_ENABLE_ROOT_PROFILES', true );
add_filter( 'bp_core_enable_root_profiles', '__return_true' );
N.B. If you use BP_ENABLE_ROOT_PROFILES there might be a situation where some user profiles get the same url as some posts or pages rendering either of them inaccessible. This might also be true of sub-sites if you』re running multisite with subdirectories. See ticket #1426 for more information.
Change the default tab opened when looking at a user』s profile (default is activity):
define( 'BP_DEFAULT_COMPONENT', 'profile' );
(Note: if you change the URL slug of xprofile, say, define ( 'BP_XPROFILE_SLUG', 'info' );, you would have to change it here accordingly,  define( 'BP_DEFAULT_COMPONENT', 'info' );  otherwise, link to the profile page would always jump to homepage.)
Change the default tab opened when looking at a group (default is home):
define( 'BP_GROUPS_DEFAULT_EXTENSION', 'members' );
Disable the admin bar / buddybar at the top of every screen:
define ( 'BP_DISABLE_ADMIN_BAR', true );
Swap the Buddybar for the WordPress toolbar: (default in buddypress 1.6)
define ( 'BP_USE_WP_ADMIN_BAR', true );
Disable the custom header functionality on the default BuddyPress theme:
define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
Disable the 「You』ll need to activate a BuddyPress compatible theme…」 warning message in the WordPress administration screens:
define( 'BP_SILENCE_THEME_NOTICE', true );
Enable support for LDAP usernames that include dots:
define( 'BP_ENABLE_USERNAME_COMPATIBILITY_MODE', true );
Disable auto-joining of a group when non group member performs group activity:
defined( 'BP_DISABLE_AUTO_GROUP_JOIN', true );
Ignore all deprecated code (don』t load it):
define ( 'BP_IGNORE_DEPRECATED', true );
add_filter( 'bp_ignore_deprecated', '__return_true' );
 
Forum Configurations
Change the parent forum to use for all BuddyPress group forums:
define ( 'BP_FORUMS_PARENT_FORUM_ID', $forum_id );
 
Database Configurations
Set a custom user database table for BuddyPress (and WordPress to use):
define ( 'CUSTOM_USER_TABLE', $tablename );
Set a custom usermeta database table for BuddyPress (and WordPress to use):
define ( 'CUSTOM_USER_META_TABLE', $tablename );
 
Multisite Configurations
Allow BuddyPress to function on multiple blogs of a WPMU installation, not just on one root blog (More details about BP_ENABLE_MULTIBLOG):
define ( 'BP_ENABLE_MULTIBLOG', true );
add_filter( 'bp_is_multiblog_mode', '__return_true' );
Set which blog ID BuddyPress will run on:
define ( 'BP_ROOT_BLOG', $blog_id );
add_filter( 'bp_get_root_blog_id', 'filter_root_blog_id' ); // return blog ID integer
 
Deprecated Configurations
Change the URL slugs of BuddyPress components:
The references to slug Constants are deprecated, this section requires updating.
define ( 'BP_ACTIVITY_SLUG', 'streams' );
define ( 'BP_BLOGS_SLUG', 'journals' );
define ( 'BP_MEMBERS_SLUG', 'users' );
define ( 'BP_FRIENDS_SLUG', 'peeps' );
define ( 'BP_GROUPS_SLUG', 'gatherings' );
define ( 'BP_FORUMS_SLUG', 'discussions' );
define ( 'BP_MESSAGES_SLUG', 'notes' );
define ( 'BP_WIRE_SLUG', 'pinboard' );
define ( 'BP_XPROFILE_SLUG', 'info' );
define ( 'BP_REGISTER_SLUG', 'signup' );
define ( 'BP_ACTIVATION_SLUG', 'enable' );
define ( 'BP_SEARCH_SLUG', 'find' );
define ( 'BP_HOME_BLOG_SLUG', 'news' );

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注