在輔助部落格上安裝

在輔助部落格上安裝

Codex Home → Legacy Docs → Archived Section: Getting Started → Installing on a Secondary Blog
Installing on a Secondary Blog

Archived file. Good only up to BP 1.5 version

***The following pertains to administrators using WordPress 3.0 in network mode)***
This option might appeal to you if you want to style and theme BuddyPress differently than your root blog.
For example, say you have an existing WordPress setup located at hxxp://example.com, but you really want to have BuddyPress located at hxxp://example.com/community (if you setup your network as a subdirectory install) or hxxp://community.example.com (if you setup your network as a subdomain install).
Interested? Read on!
(1) Configure the BP_ROOT_BLOG:
In order to run Buddypress on a secondary blog, you should create a second blog and modify BuddyPress』 internal settings to set your new blog as the BP root blog.
Next, define the 『root』 blog you would like BuddyPress to reside at by adding the code snippet below to wp-config.php:
define ( 'BP_ROOT_BLOG', $blog_id );
Example:
define ( 'BP_ROOT_BLOG', 3 );
Note: In WordPress 3.1, your $blog_id can be found by navigating to the 「Network Admin > Sites」 page and hovering over the blog in question. You should see a link that resembles this:
http://example.com/wp-admin/network/site-info.php?id=1
Your $blog_id, in this instance, would be 1.
For WordPress 3.0, the $blog_id can be found in the 「ID」 column of the 「Super Admin > Blogs」 page.
(2) Activate the BuddyPress plugin and a BuddyPress-enabled theme
Now that you have defined the BP root blog, activate a BuddyPress-enabled theme on this blog such as the 「BuddyPress Default」 theme.
(3) Keep your old BuddyPress user / group avatars
Note: This does not apply to fresh BuddyPress installs!
When you move BuddyPress to a secondary blog, the upload path to your BuddyPress avatars will change. This means your avatars will be lost.
Don』t fret though! To have your old BuddyPress user and group avatars linked from their old location, add the following lines to your bp-custom.php file:
define( 'BP_AVATAR_UPLOAD_PATH', 'YOUR_ABSOLUTE_PATH_TO_YOUR_OLD_BP_LOCATION' );
define( 'BP_AVATAR_URL', 'YOUR OLD BUDDYPRESS URL' );
For example, say you previously installed Buddypress on your root blog (blog id #1) at hxxp://example.com, you would fill in:
define( 'BP_AVATAR_UPLOAD_PATH', '/var/www/wp-content/blogs.dir/1/files' );
define( 'BP_AVATAR_URL', 'hxxp://example.com/files' );
(4) Redirect previous BuddyPress permalinks
Note: This does not apply to fresh BuddyPress installs!
Now that you have BuddyPress setup under a secondary blog, you will want to redirect your old BuddyPress permalinks so they』ll successfully resolve to their new location.
*** The following example is for a BP install on a network subdirectory setup, if you』re using a network subdomain install, your .htaccess rules will be a variation on what is posted below ***
eg. Old BuddyPress location -> New BuddyPress location
hxxp://example.com -> hxxp://example.com/community/
hxxp://example.com/members/admin -> hxxp://example.com/community/members/admin
hxxp://example.com/groups/ -> hxxp://example.com/community/groups/
hxxp://example.com/blogs/ -> hxxp://example.com/community/blogs
To do this, navigate to where your wp-config.php file is located and in the same directory, there should be a .htaccess file.
Open this file in a text editor.
Above the line:
# add a trailing slash to /wp-admin
Add the following:
RedirectMatch 301 ^/members/(.*)$ http://example.com/community/members/$1
RedirectMatch 301 ^/groups/(.*)$ http://example.com/community/groups/$1
RedirectMatch 301 ^/blogs/(.*)$ http://example.com/community/blogs/$1
RedirectMatch 301 ^/forums/(.*)$ http://example.com/community/forums/$1

Now you can enjoy your BuddyPress install at its new location!
* Posted by r-a-y.

發表回覆

您的電子郵箱地址不會被公開。 必填項已用 * 標註