Posts Tagged ‘troubleshooting’

Wordpress 2.0.×版本两个问题的解决方法

Wednesday, November 22nd, 2006

转自星月轮转,因为觉得很有用:

1. 每日自动备份失效。我一直用wp-cron配合wp-db- backup插件,每天定时将数据库备份发送到信箱中。不过好像是从2.0.4版本开始wp-db-backup插件作了修改,使得定时备份不起作用了。解决办法是在该插件的php文件的末尾,找到wpdbBackup_init函数,把其中的“if ( !current_user_can(’import’) ) return;”语句注释掉。
2. 缓存功能默认关闭。就是不在 wp-content/cache目录中写缓存文件了。解决办法是在wp-config.php文件中加一行“define (’ENABLE_CACHE’,true);”将该功能打开。WP好像从2.0.3开始就默认关闭了这个功能,因为它有一个安全隐患。不过我们大部分的WP用户并不需要为这个漏洞担心,看看这个页面上westi列的三个必要条件。我们大多都不提供用户注册功能,所以,放心吧。

[tags]wordpress,tips,troubleshooting[/tags]

powered by performancing firefox

解决BBPress无法登录的问题

Wednesday, October 18th, 2006

BBPress是一个轻量级的论坛程序,作为Wordpress的同门师弟,自然能够与Wordpress很好的集成,但我近日试装后却发现无法用Wordpress中的用户登录,登录后没有任何提示,更不能进行管理操作,注册新用户也出现同样的情况。在BBPress的论坛上看到有人遇到了同样的问题,但尝试回复中所提到的一些解决方法并没有效果,今天论坛版主(Key Master)mdawaffe在留言中提议去看一下BBPress文档中有关Cookie的部分,而这段关于Cookie的说明的确帮助我找到了解决登录问题的办法:

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.)

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.
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

注意文中的红色部分,这就是我问题的原因所在。我最初所设计的网站结构是在一个主域名下设置两个子目录,分别装Wordpress(子目录1)与BBPress(子目录2),但要将BBPress与子目录1中的Wordpress整合在一起(即BBPress装入该WP的数据库,与其共享用户数据),这样就导致了BBPress与Wordpress(子目录1)无法共享Cookie,才使得登录前后没有什么变化,BBPress文档中提到的解决方法是调整WP和BP的Cookie设置,这显然有些麻烦,而且我也不知道该如何调整:wink:,那么只好使用腾挪的“笨办法”了:将子目录2移至子目录1下,注意转移后需要更改BBPress配置文件中的相关部分:

// Just the domain name; no directories or path. There should be no trailing slash here.
$bb->domain = ‘http://主域名’; // Example: ‘http://bbpress.example.com’
// There should be both a leading and trailing slash here. ‘/’ is fine if the site is in root.
$bb->path = ‘/子目录2/’; // Example: ‘/forums/’

将其中的$bb->path = ‘/子目录2/’;改为$bb->path = ‘/子目录1/子目录2/’;即可。