Wordpress 整合 bbpress 论坛

翻译:xddxz
链接:http://www.keephelp.com/wordpress-plugin/bbpress-integration-with-wordpress/

bbPress integration should work with most recent version of WordPress in either the 2.0.x series or the 2.2.x series. You should upgrade your blog before trying to get WordPress and bbPress talking to each other.

bbpress 可以整合最近一段时间发布的 Wordpress 程序,既可以是2.0.x版本的也可以是2.2系列版本的。你应该在你准备使用bbpress整合Wordpress之前更新你的Wordpress 版本到前面所符合的版本。

Database(数据库部分)

Setting $bb->wp_table_prefix in bbPress’s config.php will tell bbPress to grab users and user meta data from those WordPress tables (as long as they are in the same database as your bbPress tables).

在config.php中设置好你的Wordpress数据库表的前缀为 $bb,这样bbPress会同步你Wordpress原来的用户表数据。

CUSTOM_USER_TABLE and CUSTOM_USER_META_TABLE may also be defined for fine grained control.

If you would like to pull user information from a different database, define USER_BBDB_NAME, USER_BBDB_USER, USER_BBDB_PASSWORD, and USER_BBDB_HOST.

Cookies

If you’ve installed bbPress into a subdirectory of your WordPress installation, define $bb->wp_home and $bb->wp_siteurl as your WordPress blog address and WordPress address, respectively. Both sites will now share the same cookies so that when you’re logged into one, you’re logged into the other. (The addresses referenced above can be found in WordPress’ Options -> General admin tab.)

为了保持Cookies同步,你最好把bbPress安装到Wordpress目录下,这样就很简单,你只要在$bb->wp_home、$bb->wp_siteurl 几个地方填写好你Wordpress目录就可以很顺利的共享Cookies信息了,用户就不需要单独登录了。

If bbPress is not installed in a subdirectory of your WordPress install, you’ll probably need to adjust both bbPress’ and WordPress’ cookies to meet your specific requirements. Below is a brief outline of the variables and constants that control the cookie behavior in the two programs.

你没有安装为WordPress的子目录,你可能需要添加相应的cookies信息让两者同步。

PHP bbPress WordPress
name $bb->usercookie USER_COOKIE
name $bb->passcookie PASS_COOKIE
path $bb->cookiepath COOKIEPATH
path $bb->sitecookiepath SITECOOKIEPATH
domain $bb->cookiedomain COOKIE_DOMAIN

Registration

When a user registers on your bbPress forum, your WordPress blog doesn’t know about it (and vice versa). The user will be created, but WordPress won’t know what user role to apply.

At the moment, integrating user registration more tightly will require a plugin both for bbPress and for WordPress. Fear not, though; we’ve created a couple sample plugins that should be enough for most installs. We have a WordPress plugin to synchronize bbPress registrations with WordPress and a bbPress plugin to display moderators’ display name instead of their username as bbPress does by default.

If you’d like to expand on these plugins or develop your own, some useful hooks to look at include bbPress’ bb_new_user, bb_set_current_user, and bb_user_has_no_caps, along with WordPress’ user_register, and set_current_user.

Functions

bbPress will not have access to WordPress’ functions unless you manually tell bbPress to load WordPress first. In order to do that, you need to put require_once('path/to/wp-blog-header.php'); in bbPress’ config.php (wp-blog-header is in the same directory as WordPress’ wp-config.php file).

This content was originally published on the bbPress blog under the title Simpler integration with WordPress.

注意:切记不要用与Wordpress同样的前缀把bbPress安装到Wordpress同样的数据库里面,否则后果不堪设想,我搞了一下午才拯救了我的博客呀。

你可能感兴趣的:(PHP,wordpress,Blog,Access)