<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>henkude &#187; BuddyPress</title>
	<atom:link href="http://henkude.com/blog/category/buddypress/feed/" rel="self" type="application/rss+xml" />
	<link>http://henkude.com</link>
	<description>hen - very, ku - cool, de - 的</description>
	<lastBuildDate>Fri, 21 May 2010 14:41:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>在 BuddyPress 中启用原生 theme editor 和 plugin editor 的最佳方案</title>
		<link>http://henkude.com/blog/2009/11/18/%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8%e5%8e%9f%e7%94%9f-theme-editor-%e5%92%8c-plugin-editor-%e7%9a%84%e6%9c%80%e4%bd%b3%e6%96%b9%e6%a1%88/</link>
		<comments>http://henkude.com/blog/2009/11/18/%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8%e5%8e%9f%e7%94%9f-theme-editor-%e5%92%8c-plugin-editor-%e7%9a%84%e6%9c%80%e4%bd%b3%e6%96%b9%e6%a1%88/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 06:34:58 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[hack]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=127</guid>
		<description><![CDATA[前面有介绍过如何在 BuddyPress 控制面板中唤回失落的 theme editor 和 plugin editor 链接，经过一番查询，终于寻获一个最安全的方案，无需触碰 core code，算是最好的 hack 了，实际上是用了 WPMU 默认加载  mu-plugins 的办法，步骤十分之简便，只需将下列代码添加到一个空的 PHP 文件: 12345&#60;?php add_action&#40; 'admin_init', create_function&#40;'$pages', 'if(is_site_admin()) return remove_action(&#34;admin_init&#34;,&#34;disable_some_pages&#34;);'&#41;,1&#41;; add_action&#40; '_admin_menu', create_function&#40;'$theme_menu', 'return add_theme_page( &#34;主题编辑器&#34;, &#34;主题编辑器&#34;, &#34;edit_themes&#34;, &#34;theme-editor.php&#34;);' &#41;&#41;; add_action&#40; '_admin_menu', create_function&#40;'$plugin_menu', 'return add_submenu_page( &#34;plugins.php&#34;, &#34;插件编辑器&#34;, &#34;插件编辑器&#34;, &#34;edit_plugins&#34;, &#34;plugin-editor.php&#34;);' &#41;&#41;; ?&#62; 代码中的中文单词可以换成你自己的翻译，然后保存为 .php 文件 (注意文件编码于主程序安装编码一致)，文件名随意取，比如我用 give_admin_theme_editor_plugin_editor.php，长是长了点，一目了然，呵呵。最后把文件上传到 /wp-content/mu-plugins/ 里，万事大吉。 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://henkude.com/blog/2009/11/17/%E5%A6%82%E4%BD%95%E5%9C%A8-buddypress-%E4%B8%AD%E5%90%AF%E7%94%A8-wp-%E5%8E%9F%E7%94%9F%E7%9A%84-theme-editor/" target="_blank">前面有介绍过</a>如何在 BuddyPress 控制面板中唤回失落的 theme editor 和 plugin editor 链接，经过一番查询，终于寻获一个最安全的方案，无需触碰 core code，算是最好的 hack 了，实际上是用了 WPMU 默认加载  mu-plugins 的办法，步骤十分之简便，只需将下列代码添加到一个空的 PHP 文件:</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_init'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/create_function"><span style="color: #990000;">create_function</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$pages'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'if(is_site_admin()) return remove_action(&quot;admin_init&quot;,&quot;disable_some_pages&quot;);'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'_admin_menu'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/create_function"><span style="color: #990000;">create_function</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$theme_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'return add_theme_page( &quot;主题编辑器&quot;, &quot;主题编辑器&quot;, &quot;edit_themes&quot;, &quot;theme-editor.php&quot;);'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'_admin_menu'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/create_function"><span style="color: #990000;">create_function</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$plugin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'return add_submenu_page( &quot;plugins.php&quot;, &quot;插件编辑器&quot;, &quot;插件编辑器&quot;, &quot;edit_plugins&quot;, &quot;plugin-editor.php&quot;);'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #000000; font-weight: bold;">?&gt;</span></div></td></tr></tbody></table></div>
<p>代码中的中文单词可以换成你自己的翻译，然后保存为 .php 文件 (注意文件编码于主程序安装编码一致)，文件名随意取，比如我用 <em>give_admin_theme_editor_plugin_editor.php</em>，长是长了点，一目了然，呵呵。最后把文件上传到 <strong>/wp-content/mu-plugins/</strong> 里，万事大吉。</p>
<p><a href="http://mu.wordpress.org/forums/topic/14647" target="_blank"><em>via</em></a></p>
<div class="shr-publisher-127"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/11/18/%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8%e5%8e%9f%e7%94%9f-theme-editor-%e5%92%8c-plugin-editor-%e7%9a%84%e6%9c%80%e4%bd%b3%e6%96%b9%e6%a1%88/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>如何在 BuddyPress 中启用 WP 原生的 theme editor</title>
		<link>http://henkude.com/blog/2009/11/17/%e5%a6%82%e4%bd%95%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8-wp-%e5%8e%9f%e7%94%9f%e7%9a%84-theme-editor/</link>
		<comments>http://henkude.com/blog/2009/11/17/%e5%a6%82%e4%bd%95%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8-wp-%e5%8e%9f%e7%94%9f%e7%9a%84-theme-editor/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 13:19:28 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[editor]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[WPMU]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=71</guid>
		<description><![CDATA[由于 BuddyPress 是基于 WPMU，因此后台和 WPMU 一样隐藏并禁用了 WP 原生的 theme editor，如果想在 BuddyPress 里使用 WP 原生的 theme editor，只要遵循以下步骤 (基于 BuddyPress 1.1.2/WPMU 2.8.5.2): 注释掉 /wp-admin/includes/mu.php 第556行: 1unset&#40; $submenu&#91;'themes.php'&#93;&#91;10&#93; &#41;; // always remove the themes editor 替换成 1//unset( $submenu['themes.php'][10] ); // always remove the themes editor 仍然在这个文件中，第1128行: 1if &#40; strpos&#40; $_SERVER&#91;'PHP_SELF'&#93;, $page &#41; &#41; &#123; 替换成 1if &#40; strpos&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>由于 BuddyPress 是基于 WPMU，因此后台和 WPMU 一样隐藏并禁用了 WP 原生的 theme editor，如果想在 BuddyPress 里使用 WP 原生的 theme editor，只要遵循以下步骤 (基于 BuddyPress 1.1.2/WPMU 2.8.5.2):</p>
<ol>
<li>注释掉 /wp-admin/includes/mu.php 第556行:
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$submenu</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'themes.php'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// always remove the themes editor</span></div></td></tr></tbody></table></div>
<p>替换成</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//unset( $submenu['themes.php'][10] ); // always remove the themes editor</span></div></td></tr></tbody></table></div>
</li>
<li>仍然在这个文件中，第1128行:
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></td></tr></tbody></table></div>
<p>替换成</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$page</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>is_site_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span></div></td></tr></tbody></table></div>
</li>
</ol>
<p>这样可以确保只有在站点管理员 (Site Admin) 的后台界面才显示并激活原生的 theme editor。</p>
<p>另外，如果同时注释掉第555行:</p>
<ul>
<li>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$submenu</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'plugins.php'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// always remove the plugin editor</span></div></td></tr></tbody></table></div>
<p>替换成</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//unset( $submenu['plugins.php'][15] ); // always remove the plugin editor</span></div></td></tr></tbody></table></div>
</li>
</ul>
<p>那么可以同时激活原生的 plugin editor, ooops  <img src='http://henkude.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>参考: <a href="http://mu.wordpress.org/forums/topic/13318" target="_blank">http://mu.wordpress.org/forums/topic/13318</a></p>
<p><span style="color: #ff0000"><strong>Update:</strong></span> 以上代码位置在 BuddyPress 1.1.2/WPMU 2.8.6 没有变动。</p>
<div class="shr-publisher-71"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/11/17/%e5%a6%82%e4%bd%95%e5%9c%a8-buddypress-%e4%b8%ad%e5%90%af%e7%94%a8-wp-%e5%8e%9f%e7%94%9f%e7%9a%84-theme-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>解决 BuddyPress 1.1.2 首页全站动态 widget 的中文字符 URL 乱码问题</title>
		<link>http://henkude.com/blog/2009/11/11/%e8%a7%a3%e5%86%b3-buddypress-1-1-2-%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url-%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98/</link>
		<comments>http://henkude.com/blog/2009/11/11/%e8%a7%a3%e5%86%b3-buddypress-1-1-2-%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url-%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 08:10:53 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[fix]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=51</guid>
		<description><![CDATA[前一篇日志中提到 BuddyPress 在自动升级后首页的全站动态 (Site Wide Activity) 里凡是有中文字符的 URL 多多少少都出现了乱码，导致 URL 无效，经过在官方论坛上的求证后，从 levinng 朋友那里得到这样一个可行的解决方案，测试有效: 在 /wp-content/plugins/buddypress/bp-activity/bp-activity-filters.php 文件中，注释掉第4、5两行代码 12add_filter&#40; 'bp_get_activity_content', 'bp_activity_filter_kses', 1 &#41;; add_filter&#40; 'bp_get_activity_content', 'bp_activity_filter_kses', 1 &#41;; 改为 12/* add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); */ /* add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); */ 这样问题就解决了，希望官方能尽快给出一个可靠的完美解决，毕竟 kses filter 还是蛮有用的，可以过滤一些 HTML 代码以免破坏页面格局。]]></description>
			<content:encoded><![CDATA[<p><a href="http://henkude.com/blog/2009/11/04/buddypress-1-1-1-%E8%87%AA%E5%8A%A8%E5%8D%87%E7%BA%A7%E8%87%B3-1-1-2-%E5%90%8E%EF%BC%8C%E9%A6%96%E9%A1%B5%E5%85%A8%E7%AB%99%E5%8A%A8%E6%80%81-widget-%E7%9A%84%E4%B8%AD%E6%96%87%E5%AD%97%E7%AC%A6-url/">前一篇日志</a>中提到 BuddyPress 在自动升级后首页的全站动态 (Site Wide Activity) 里凡是有中文字符的 URL 多多少少都出现了乱码，导致 URL 无效，经过在官方论坛上的求证后，从 <em>levinng</em> 朋友那里得到这样一个可行的解决方案，测试有效:</p>
<p>在 <span style="color: #008000"><strong>/wp-content/plugins/buddypress/bp-activity/bp-activity-filters.php</strong></span> 文件中，注释掉第4、5两行代码</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'bp_get_activity_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'bp_activity_filter_kses'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'bp_get_activity_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'bp_activity_filter_kses'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>改为</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">/* add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); */</span><br />
<span style="color: #666666; font-style: italic;">/* add_filter( 'bp_get_activity_content', 'bp_activity_filter_kses', 1 ); */</span></div></td></tr></tbody></table></div>
<p>这样问题就解决了，希望官方能尽快给出一个可靠的完美解决，毕竟 kses filter 还是蛮有用的，可以过滤一些 HTML 代码以免破坏页面格局。</p>
<div class="shr-publisher-51"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/11/11/%e8%a7%a3%e5%86%b3-buddypress-1-1-2-%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url-%e4%b9%b1%e7%a0%81%e9%97%ae%e9%a2%98/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>BuddyPress 1.1.1 自动升级至 1.1.2 后，首页全站动态 widget 的中文字符 URL 出现乱码</title>
		<link>http://henkude.com/blog/2009/11/04/buddypress-1-1-1-%e8%87%aa%e5%8a%a8%e5%8d%87%e7%ba%a7%e8%87%b3-1-1-2-%e5%90%8e%ef%bc%8c%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url/</link>
		<comments>http://henkude.com/blog/2009/11/04/buddypress-1-1-1-%e8%87%aa%e5%8a%a8%e5%8d%87%e7%ba%a7%e8%87%b3-1-1-2-%e5%90%8e%ef%bc%8c%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 18:42:13 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[bug]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=42</guid>
		<description><![CDATA[1.1.1 在后台使用自动升级后，首页的全站动态 widget 出现问题，blog 文章标题中含有中文字符集全角标点符号的，URL 中会出现乱码，导致链接无效，详见下图 (点击放大) 在官网的 trac 上的 ticket: http://trac.buddypress.org/ticket/1326]]></description>
			<content:encoded><![CDATA[<p>1.1.1 在后台使用自动升级后，首页的全站动态 widget 出现问题，blog 文章标题中含有中文字符集全角标点符号的，URL 中会出现乱码，导致链接无效，详见下图 (点击放大)</p>
<div id="attachment_43" class="wp-caption alignnone" style="width: 310px"><a href="http://henkude.com/files/2009/11/2009-11-5-1-58-54.png"><img class="size-medium wp-image-43" src="http://henkude.com/files/2009/11/2009-11-5-1-58-54-300x230.png" alt="URL 中的中文字符出现乱码" width="300" height="230" /></a><p class="wp-caption-text">URL 中的中文字符出现乱码</p></div>
<p>在官网的 trac 上的 ticket: <a href="http://trac.buddypress.org/ticket/1326" target="_blank">http://trac.buddypress.org/ticket/1326</a></p>
<div class="shr-publisher-42"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/11/04/buddypress-1-1-1-%e8%87%aa%e5%8a%a8%e5%8d%87%e7%ba%a7%e8%87%b3-1-1-2-%e5%90%8e%ef%bc%8c%e9%a6%96%e9%a1%b5%e5%85%a8%e7%ab%99%e5%8a%a8%e6%80%81-widget-%e7%9a%84%e4%b8%ad%e6%96%87%e5%ad%97%e7%ac%a6-url/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>The time machine of BuddyPress taking everything nearby back to memory</title>
		<link>http://henkude.com/blog/2009/10/27/the-time-machine-of-buddypress-taking-everything-nearby-back-to-memory/</link>
		<comments>http://henkude.com/blog/2009/10/27/the-time-machine-of-buddypress-taking-everything-nearby-back-to-memory/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 13:37:52 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=24</guid>
		<description><![CDATA[终于搞明白了 BuddyPress 这个诡异的时间问题。 按照 web app 的常识，主程序设定用户时区便可以正常显示，然而在 BuddyPress 并不是这样，它是 WPMU 的一个插件，它的相对时间首先看齐于 group/forum/status/wire 这些 BuddyPress 组件，对于 WPMU 的 blog 组件实际上处于一个平行关系，再加上 WPMU 的多用户 blog，每个用户的 blog 有可能设置不同的时区，BuddyPress 产生时间混沌看上去是一件不可避免的事情，不过这并不是什么坏事，这只是产品成熟过程中的一个里程碑，目前来说，无论 BuddyPress 的站长身处哪个时区，都必须将主 blog (也就是 WPMU 安装时的默认初始 blog) 的时区对准服务器所在的时区，这看上去像一个内部框架向主框架的反包围，不过这确实解决了 BuddyPress 首页的全站动态 (Site Wide Activity) 时间线混乱的问题，唯一的副作用就是，凡是主 blog 的 post 时间都是服务器时间，而非用户身处的时区了。 Finally, we approached in a solution of this weird BuddyPress &#8220;since&#8221; time [...]]]></description>
			<content:encoded><![CDATA[<p>终于搞明白了 BuddyPress 这个诡异的时间问题。</p>
<p>按照 web app 的常识，主程序设定用户时区便可以正常显示，然而在 BuddyPress 并不是这样，它是 WPMU 的一个插件，它的相对时间首先看齐于 group/forum/status/wire 这些 BuddyPress 组件，对于 WPMU 的 blog 组件实际上处于一个平行关系，再加上 WPMU 的多用户 blog，每个用户的 blog 有可能设置不同的时区，BuddyPress 产生时间混沌看上去是一件不可避免的事情，不过这并不是什么坏事，这只是产品成熟过程中的一个里程碑，目前来说，无论 BuddyPress 的站长身处哪个时区，都必须将主 blog (也就是 WPMU 安装时的默认初始 blog) 的时区对准服务器所在的时区，这看上去像一个内部框架向主框架的反包围，不过这确实解决了 BuddyPress 首页的全站动态 (Site Wide Activity) 时间线混乱的问题，唯一的副作用就是，凡是主 blog 的 post 时间都是服务器时间，而非用户身处的时区了。<br />
 <span id="more-24"></span><br />
 Finally, we approached in a solution of this weird BuddyPress &#8220;since&#8221; time phenomenon.</p>
<p>Usually, the time/date mechanism of a web app will run responsively after the user timezone is set, that doesn&#8217;t happen to BuddyPress since it&#8217;s a plugin of WPMU, actually, it serves group/forum/status/wire components, and keeps a parallel relationship with WPMU, which is designed to be multi-user platform. Every user in a WPMU site could have his/her blog timezone set separately, this convenience has its little buddy plugin an inevitable destiny of timeline chaos. After all, that&#8217;s not so bad, it leads to a milestone of the product development.</p>
<p>For now, wherever the webmaster of a WPMU+BuddyPress community site is hosted, he/she will have no alternative but set the timezone of default blog (automatically created by WPMU installation) to notch the hosting server system time, which look like a subframework fights back its parent framework, but the phenomenon is eliminated, the &#8220;since&#8221; time in Site Wide Activity stream is back to peace again, regardless of the post on default admin blog being published on server time instead of the timezone user stays in.</p>
<div class="shr-publisher-24"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/10/27/the-time-machine-of-buddypress-taking-everything-nearby-back-to-memory/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>BuddyPress 很酷的时区问题暂时得以解决</title>
		<link>http://henkude.com/blog/2009/10/25/buddypress-timezone-bug-temporar-solution/</link>
		<comments>http://henkude.com/blog/2009/10/25/buddypress-timezone-bug-temporar-solution/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 20:23:20 +0000</pubDate>
		<dc:creator>Kude Hen</dc:creator>
				<category><![CDATA[BuddyPress]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[timezone]]></category>

		<guid isPermaLink="false">http://henkude.com/?p=10</guid>
		<description><![CDATA[/wp-content/plugins/buddypress/bp-core.php, line 1289 &#8211; line 1292: 1234$since = $newer_date - $older_date;&#60;/p&#62; &#60;p&#62;if &#40; 0 &#38;gt; $since &#41;&#60;br /&#62; &#160;return __&#40; '[Use GMT Timezone]', 'buddypress' &#41;; 改成 12345$since = $newer_date - $older_date - 50400;&#60;/p&#62; &#60;p&#62;if &#40; 0 &#38;gt; $since &#41;&#60;br /&#62; &#160;$since = $since + 50400;&#60;br /&#62; &#160;//        return __( '[Use GMT Timezone]', 'buddypress' ); [...]]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color: #008000">/wp-content/plugins/buddypress/bp-core.php, line 1289 &#8211; line 1292:</span></strong></p>
<p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$since</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$newer_date</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$older_date</span><span style="color: #339933;">;&lt;/</span>p<span style="color: #339933;">&gt;</span><br />
<br />
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>if <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$since</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp;<span style="color: #b1b100;">return</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'[Use GMT Timezone]'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'buddypress'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
</p>
<p>改成</p>
<p><div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000088;">$since</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$newer_date</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$older_date</span> <span style="color: #339933;">-</span> <span style="color: #cc66cc;">50400</span><span style="color: #339933;">;&lt;/</span>p<span style="color: #339933;">&gt;</span><br />
<br />
<span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>if <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;</span>gt<span style="color: #339933;">;</span> <span style="color: #000088;">$since</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp;<span style="color: #000088;">$since</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$since</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">50400</span><span style="color: #339933;">;&lt;</span>br <span style="color: #339933;">/&gt;</span><br />
&nbsp;<span style="color: #666666; font-style: italic;">//        return __( '[Use GMT Timezone]', 'buddypress' );</span></div></td></tr></tbody></table></div>
</p>
<p>50400 是本地时间和服务器时间的时间差，以秒计，henkude 服务器在 UTC-6，而我们都在 UTC+8，因此相差14个小时，也就是50400秒，之所以要在后面再加回去是因为 BuddyPress 的这个 bug 只存在于全站动态 (Site Wide Activity) 里，其他地方都 OK，所以当这个值为负值时，只有全站动态里是正常的，其他地方就只能显示 Use GMT Timezone，所以要加回去才能正确显示。</p>
<p>归根究底，BuddyPress 是 WPMU 的一个插件，不知道为什么会使用两套时间戳算法，在 BuddyPress 官网上找了半天，只找到自己大半年前去问这个问题的<a href="http://buddypress.org/forums/topic/timezone-problem" target="_blank">帖子</a>，还是被一个老外 moderator 揶揄了一番，郁闷。虽然也有说 trac 里面给出了补丁，可是怎么翻也没翻到，简直是一片混战。论坛上有人了<a href="http://buddypress.org/forums/topic/adjust-time-zone#post-13371" target="_blank">这么个临时解决方法</a>，没时间测试了，貌似也没我这样省事。</p>
<p><strong><span style="color: #ff0000">Update:</span></strong> 这个方法在 BP 安装24小时后开始失效，据官方论坛称，BP 的相对时间问题会在安装后24小时自动纠正，但实际上 blog 输出到全站动态的时间是正确的，而论坛帖子输出的时间确实服务器的时间而不是用户设定的本地时间，这个问题已经<a href="http://trac.buddypress.org/ticket/1274" target="_blank">提交到 BP 的 trac</a>，不知道会不会有下文，这实在是个历史悠久的老虫子了。<a href="http://dl.getdropbox.com/u/128925/buddypress-time-problem.png" target="_blank">附一张截图说明</a>。</p>
<div class="shr-publisher-10"></div>]]></content:encoded>
			<wfw:commentRss>http://henkude.com/blog/2009/10/25/buddypress-timezone-bug-temporar-solution/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

