{"id":27589,"date":"2024-11-03T05:20:47","date_gmt":"2024-11-02T20:20:47","guid":{"rendered":"https:\/\/kimassi.net\/zak\/?p=27589"},"modified":"2026-05-16T16:43:00","modified_gmt":"2026-05-16T07:43:00","slug":"wordpress%e3%81%ae%e6%8e%b2%e7%a4%ba%e6%9d%bfbbpress%e3%82%92%e3%82%a2%e3%83%ac%e3%83%b3%e3%82%b8%e3%81%97%e3%81%a6%e3%81%bf%e3%81%9f","status":"publish","type":"post","link":"https:\/\/kimassi.net\/zak\/?p=27589","title":{"rendered":"WordPress\u306e\u63b2\u793a\u677fbbpress\u3092\u30a2\u30ec\u30f3\u30b8\u3057\u3066\u307f\u305f"},"content":{"rendered":"<p><span style=\"color: #800080;\">WordPress\u306e\u63b2\u793a\u677fbbpress\u306f\u3001\u305d\u306e\u307e\u307e\u3060\u3068\u6c17\u306b\u306a\u308b\u90e8\u5206\u304c\u3042\u308b\u306e\u3067\u30a2\u30ec\u30f3\u30b8\u3057\u3066\u307f\u307e\u3057\u305f\u3002<br \/>\nWordpress\u306e\u63b2\u793a\u677fbbpress\u306f\u3001PPH\u3067\u4f5c\u3089\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001PPH\u306b\u3064\u3044\u3066\u306f\u57fa\u672c\u7684\u306a\u77e5\u8b58\u3057\u304b\u7121\u3044\u306e\u3067\u82e6\u52b4\u3057\u307e\u3057\u305f\u3002<br \/>\n<\/span><\/p>\n<p><span style=\"color: #ff00ff;\">\u6295\u7a3f\u6642\u306burl\u3092\u5165\u529b\u3059\u308b\u306e\u3092\u524a\u9664<\/span><span style=\"color: #800080;\">\u3057\u305f\u3044\u306e\u3067plugins\u306e\u4e2d\u306e<\/span><br \/>\n<span style=\"color: #800080;\">wp-content\u30fb\u30fb\u30fbplugins\u30fb\u30fb\u30fbbbpress\u30fb\u30fb\u30fbtemplates\u30fb\u30fb\u30fbdefault\u30fb\u30fb\u30fbbbpress\u30fb\u30fb\u30fbform-anonymous.php<\/span><br \/>\n<span style=\"color: #800080;\">\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>&lt;p&gt;<br \/>\n&lt;label for=&#8221;bbp_anonymous_website&#8221;&gt;&lt;?php esc_html_e( &#8216;Website:&#8217;, &#8216;bbpress&#8217; ); ?&gt;&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;input type=&#8221;text&#8221; id=&#8221;bbp_anonymous_website&#8221; value=&#8221;&lt;?php bbp_author_url(); ?&gt;&#8221; size=&#8221;40&#8243; maxlength=&#8221;200&#8243; name=&#8221;bbp_anonymous_website&#8221; \/&gt;<br \/>\n&lt;\/p&gt;<\/p>\n<p><span style=\"color: #800080;\">\u306e\u90e8\u5206\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #ff00ff;\">\u30c8\u30d4\u30c3\u30af\u4e00\u89a7\u304b\u3089\u30c8\u30d4\u30c3\u30af\u4f5c\u6210\u8005\u306e\u8868\u793a\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002<\/span><br \/>\n<span style=\"color: #800080;\">plugins\u306e\u4e2d\u306e<\/span><br \/>\n<span style=\"color: #800080;\">templates\u30fb\u30fb\u30fbdefault\u30fb\u30fb\u30fbbbpress\u30fb\u30fb\u30fbloop-single-topic.php<\/span><br \/>\n<span style=\"color: #800080;\">\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>&lt;?php do_action( &#8216;bbp_theme_before_topic_started_by&#8217; ); ?&gt;<\/p>\n<p>&lt;span class=&#8221;bbp-topic-started-by&#8221;&gt;&lt;?php printf( __( &#8216;Started by: %1$s&#8217;, &#8216;bbpress&#8217; ), bbp_get_topic_author_link( array( &#8216;size&#8217; =&gt; &#8217;14&#8217; ) ) ); ?&gt;&lt;\/span&gt;<\/p>\n<p>&lt;?php do_action( &#8216;bbp_theme_after_topic_started_by&#8217; ); ?&gt;<\/p>\n<p><span style=\"color: #800080;\">\u306e\u90e8\u5206\u3068<\/span><\/p>\n<p>&lt;p class=&#8221;bbp-topic-meta&#8221;&gt;<\/p>\n<p>&lt;?php do_action( &#8216;bbp_theme_before_topic_freshness_author&#8217; ); ?&gt;<\/p>\n<p>&lt;span class=&#8221;bbp-topic-freshness-author&#8221;&gt;&lt;?php bbp_author_link( array( &#8216;post_id&#8217; =&gt; bbp_get_topic_last_active_id(), &#8216;size&#8217; =&gt; 14 ) ); ?&gt;&lt;\/span&gt;<\/p>\n<p>&lt;?php do_action( &#8216;bbp_theme_after_topic_freshness_author&#8217; ); ?&gt;<\/p>\n<p>&lt;\/p&gt;<\/p>\n<p><span style=\"color: #800080;\">\u306e\u90e8\u5206\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #ff00ff;\">\u300c\u3053\u306e\u30d5\u30a9\u30fc\u30e9\u30e0\u306b\u306f1\u4ef6\u306e\u30c8\u30d4\u30c3\u30af\u304c\u542b\u307e\u308c\u30012 \u6642\u9593\u3001 40 \u5206\u524d\u306b \u4fca \u3055\u3093\u304c\u6700\u5f8c\u306e\u66f4\u65b0\u3092\u884c\u3044\u307e\u3057\u305f\u3002\u300d\u3068\u3044\u3046\u306e\u3082\u524a\u9664\u3059\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #800080;\">plugins\u306e\u4e2d\u306e<\/span><br \/>\n<span style=\"color: #800080;\">includes\u30fb\u30fb\u30fbforums\u30fb\u30fb\u30fbtemplate.php<\/span><br \/>\n<span style=\"color: #800080;\">\u306e\uff1215\uff10\u884c\u4ed8\u8fd1\u306b\u3042\u308b<\/span><\/p>\n<p>\/\/ Forum has active data<br \/>\nif ( !empty( $last_active ) ) {<\/p>\n<p>if ( !empty( $reply_count ) ) {<\/p>\n<p>if ( bbp_is_forum_category( $forum_id ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This category contains %1$s and %2$s, and was last updated by %3$s %4$s.<\/span>&#8216;, &#8216;bbpress&#8217; ), $topic_text, $reply_text, $last_updated_by, $time_since );<br \/>\n} else {<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This forum contains %1$s and %2$s, and was last updated by %3$s %4$s.<\/span>&#8216;, &#8216;bbpress&#8217; ), $topic_text, $reply_text, $last_updated_by, $time_since );<br \/>\n}<\/p>\n<p>} else {<\/p>\n<p>if ( bbp_is_forum_category( $forum_id ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This category contains %1$s, and was last updated by %2$s %3$s.<\/span>&#8216;, &#8216;bbpress&#8217; ), $topic_text, $last_updated_by, $time_since );<br \/>\n} else {<br \/>\n$retstr = sprintf( esc_html__( <span style=\"color: #0000ff;\">&#8216;This forum contains %1$s, and was last updated by %2$s %3$s.<\/span>&#8216;,&#8217;bbpress&#8217; ), $topic_text, $last_updated_by, $time_since );<br \/>\n}<br \/>\n}<\/p>\n<p>\/\/ Forum has no last active data<br \/>\n} else {<\/p>\n<p>if ( !empty( $reply_count ) ) {<\/p>\n<p>if ( bbp_is_forum_category( $forum_id ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;This category contains %1$s and %2$s.&#8217;, &#8216;bbpress&#8217; ), $topic_text, $reply_text );<br \/>\n} else {<br \/>\n$retstr = sprintf( esc_html__( &#8216;This forum contains %1$s and %2$s.&#8217;, &#8216;bbpress&#8217; ), $topic_text, $reply_text );<br \/>\n}<\/p>\n<p>} else {<\/p>\n<p>if ( !empty( $topic_count ) ) {<\/p>\n<p>if ( bbp_is_forum_category( $forum_id ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;This category contains %1$s.&#8217;, &#8216;bbpress&#8217; ), $topic_text );<br \/>\n} else {<br \/>\n$retstr = sprintf( esc_html__( &#8216;This forum contains %1$s.&#8217;, &#8216;bbpress&#8217; ), $topic_text );<br \/>\n}<\/p>\n<p>} else {<br \/>\n$retstr = esc_html__( &#8216;This forum is empty.&#8217;, &#8216;bbpress&#8217; );<br \/>\n}<br \/>\n}<br \/>\n}<\/p>\n<p><span style=\"color: #800080;\">\u306e\u9752\u8272\u306e\u90e8\u5206\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #ff00ff;\">\u300c\u3053\u306e\u30c8\u30d4\u30c3\u30af\u306b\u306f 0\u4ef6\u306e\u8fd4\u4fe1 \u3001 1\u4eba\u306e\u53c2\u52a0\u8005 \u304c\u542b\u307e\u308c\u307e\u3059\u3002 \u6700\u7d42\u66f4\u65b0 by syun 5 \u65e5\u3001 22 \u6642\u9593\u524d.\u300d\u3082\u524a\u9664\u3059\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #800080;\">plugins\u306e\u4e2d\u306e<\/span><br \/>\n<span style=\"color: #800080;\">includes\u30fb\u30fb\u30fbtopics\u30fb\u30fb\u30fbtemplate.php<\/span><br \/>\n<span style=\"color: #800080;\">\u306e3368\u884c\u4ed8\u8fd1\u306e<\/span><\/p>\n<p>function bbp_get_single_topic_description( $args = &#8221; ) {<\/p>\n<p>\/\/ Parse arguments against default values<br \/>\n$r = bbp_parse_args( $args, array(<br \/>\n&#8216;topic_id&#8217; =&gt; 0,<br \/>\n&#8216;before&#8217; =&gt; &#8216;&lt;div class=&#8221;bbp-template-notice info&#8221;&gt;&lt;p class=&#8221;bbp-topic-description&#8221;&gt;&#8217;,<br \/>\n&#8216;after&#8217; =&gt; &#8216;&lt;\/p&gt;&lt;\/div&gt;&#8217;,<br \/>\n&#8216;size&#8217; =&gt; 14<br \/>\n), &#8216;get_single_topic_description&#8217; );<\/p>\n<p>\/\/ Validate topic_id<br \/>\n$topic_id = bbp_get_topic_id( $r[&#8216;topic_id&#8217;] );<\/p>\n<p>\/\/ Unhook the &#8216;view all&#8217; query var adder<br \/>\nremove_filter( &#8216;bbp_get_topic_permalink&#8217;, &#8216;bbp_add_view_all&#8217; );<\/p>\n<p>\/\/ Build the topic description<br \/>\n$vc_int = bbp_get_topic_voice_count ( $topic_id, true );<br \/>\n$voice_count = bbp_get_topic_voice_count ( $topic_id, false );<br \/>\n$reply_count = bbp_get_topic_replies_link ( $topic_id );<br \/>\n$time_since = bbp_get_topic_freshness_link( $topic_id );<\/p>\n<p>\/\/ Singular\/Plural<br \/>\n$voice_count = sprintf( _n( &#8216;%s voice&#8217;, &#8216;%s voices&#8217;, $vc_int, &#8216;bbpress&#8217; ), $voice_count );<\/p>\n<p>\/\/ Topic has replies<br \/>\n$last_reply = bbp_get_topic_last_reply_id( $topic_id );<br \/>\nif ( !empty( $last_reply ) ) {<br \/>\n$last_updated_by = bbp_get_author_link( array( &#8216;post_id&#8217; =&gt; $last_reply, &#8216;size&#8217; =&gt; $r[&#8216;size&#8217;] ) );<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This topic contains %1$s, has %2$s, and was last updated by %3$s %4$s.<\/span>&#8216;, &#8216;bbpress&#8217; ), $reply_count, $voice_count, $last_updated_by, $time_since );<\/p>\n<p>\/\/ Topic has no replies<br \/>\n} elseif ( ! empty( $voice_count ) &amp;&amp; ! empty( $reply_count ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This topic contains %1$s and has %2$s.<\/span>&#8216;, &#8216;bbpress&#8217; ), $voice_count, $reply_count );<\/p>\n<p>\/\/ Topic has no replies and no voices<br \/>\n} elseif ( empty( $voice_count ) &amp;&amp; empty( $reply_count ) ) {<br \/>\n$retstr = sprintf( esc_html__( &#8216;<span style=\"color: #0000ff;\">This topic has no replies.<\/span>&#8216;, &#8216;bbpress&#8217; ), $voice_count, $reply_count );<br \/>\n}<\/p>\n<p>\/\/ Add the &#8216;view all&#8217; filter back<br \/>\nadd_filter( &#8216;bbp_get_topic_permalink&#8217;, &#8216;bbp_add_view_all&#8217; );<\/p>\n<p>\/\/ Combine the elements together<br \/>\n$retstr = $r[&#8216;before&#8217;] . $retstr . $r[&#8216;after&#8217;];<\/p>\n<p>\/\/ Return filtered result<br \/>\nreturn apply_filters( &#8216;bbp_get_single_topic_description&#8217;, $retstr, $r );<br \/>\n}<\/p>\n<p><span style=\"color: #800080;\">\u306e\u9752\u8272\u306e\u90e8\u5206\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #800080;\">\u4f59\u8a08\u306a\u90e8\u5206\u3092\u524a\u9664\u3057\u3066\u3001\u3059\u3063\u304d\u308a\u3057\u305f\u3068\u601d\u3044\u307e\u3059\u3002<\/span><\/p>\n<p>\u30e1\u30fc\u30eb\u306e\u767b\u9332\u3057\u306a\u304f\u3066\u3082\u6295\u7a3f\u3067\u304d\u308b\u3088\u3046\u306b\u3057\u307e\u3057\u305f\u3002<br \/>\n<strong>https:\/\/www.cherrypieweb.com\/5357\u3000\u3092\u53c2\u8003\uff08<span style=\"color: #ff0000;\">\u30d0\u30fc\u30b8\u30e7\u30f3\u306b\u3088\u3063\u3066\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u306a\u3044\u4e8b\u304c\u3042\u308b\u3088\u3046\u3067\u3059\u3002\u5fc5\u305a\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u3092\u3068\u3063\u3066\u304a\u3044\u3066\u304f\u3060\u3055\u3044\u3000\u3000bbpress 2.6.14 \u3000PHP74\u3067\u52d5\u4f5c\u78ba\u8a8d<\/span><\/strong><strong>\uff09\u306b<br \/>\n<\/strong>bbpress\/includes\/common\/functions.php\u3000\u306b<br \/>\n\u6b21\u306e\u30b3\u30fc\u30c9\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br \/>\n\u5834\u6240\u306f\u3069\u3053\u3067\u3082\u826f\u3044\u3067\u3059\u304c<br \/>\n50\u884c\u4ed8\u8fd1\u306e<\/p>\n<p>function bbp_get_redirect_to() {<\/p>\n<p>\/\/ Check &#8216;redirect_to&#8217; request parameter<br \/>\n$retval = ! empty( $_REQUEST[&#8216;redirect_to&#8217;] )<br \/>\n? $_REQUEST[&#8216;redirect_to&#8217;]<br \/>\n: &#8221;;<\/p>\n<p>\/\/ Filter &amp; return<br \/>\nreturn apply_filters( &#8216;bbp_get_redirect_to&#8217;, $retval );<br \/>\n}<\/p>\n<p><span style=\"color: #993366;\">\u306e\u4e0b\u306b<\/span><\/p>\n<p>function bbp_set_default_email( $post_author_email ) {<br \/>\nif ( empty( $post_author_email ) ) {<br \/>\n$post_author_email = &#8216;anonymous@example.com&#8217;;<br \/>\n}<br \/>\nreturn $post_author_email;<br \/>\n}<br \/>\nadd_filter( &#8216;bbp_pre_anonymous_post_author_email&#8217;, &#8216;bbp_set_default_email&#8217;, 10, 1 );<\/p>\n<p>function bbp_remove_default_email( $r, $args ) {<br \/>\nif ( $r[&#8216;bbp_anonymous_email&#8217;] == &#8216;anonymous@example.com&#8217; ) {<br \/>\n$r[&#8216;bbp_anonymous_email&#8217;] = &#8221;;<br \/>\n}<br \/>\nreturn $r;<br \/>\n}<br \/>\nadd_filter( &#8216;bbp_filter_anonymous_post_data&#8217;, &#8216;bbp_remove_default_email&#8217;, 10, 2 );<\/p>\n<p><span style=\"color: #993366;\">\u3092\u8ffd\u52a0\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p><span style=\"color: #800080;\">wp-content\u30fb\u30fb\u30fbplugins\u30fb\u30fb\u30fbbbpress\u30fb\u30fb\u30fbtemplates\u30fb\u30fb\u30fbdefault\u30fb\u30fb\u30fbbbpress\u30fb\u30fb\u30fbform-anonymous.php<br \/>\n\u3092\u5909\u66f4\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>30\u884c\u4ed8\u8fd1\u306e<br \/>\n&lt;label for=&#8221;bbp_anonymous_email&#8221;&gt;&lt;?php esc_html_e( &#8216;Mail (will not be published) <span style=\"color: #0000ff;\">(required)<\/span>:&#8217;, &#8216;bbpress&#8217; ); ?&gt;&lt;\/label&gt;&lt;br \/&gt;<br \/>\n&lt;input type=&#8221;text&#8221; id=&#8221;bbp_anonymous_email&#8221; value=&#8221;&lt;?php bbp_author_email(); ?&gt;&#8221; size=&#8221;40&#8243; maxlength=&#8221;100&#8243; name=&#8221;bbp_anonymous_email&#8221; \/&gt;<\/p>\n<p><span style=\"color: #800080;\">\u306e\u9752\u8272\u90e8\u5206\u3092\u524a\u9664\u3057\u307e\u3057\u305f\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>WordPress\u306e\u63b2\u793a\u677fbbpress\u306f\u3001\u305d\u306e\u307e\u307e\u3060\u3068\u6c17\u306b\u306a\u308b\u90e8\u5206\u304c\u3042\u308b\u306e\u3067\u30a2\u30ec\u30f3\u30b8\u3057\u3066\u307f\u307e\u3057\u305f\u3002 Wordpress\u306e\u63b2\u793a\u677fbbpress\u306f\u3001PPH\u3067\u4f5c\u3089\u308c\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001PPH\u306b\u3064\u3044\u3066\u306f\u57fa\u672c\u7684\u306a\u77e5\u8b58\u3057\u304b\u7121\u3044\u306e\u3067\u82e6\u52b4 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[48,17,19],"tags":[],"class_list":["post-27589","post","type-post","status-publish","format-standard","hentry","category-php","category-17","category-19"],"_links":{"self":[{"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/posts\/27589","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=27589"}],"version-history":[{"count":7,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/posts\/27589\/revisions"}],"predecessor-version":[{"id":32401,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=\/wp\/v2\/posts\/27589\/revisions\/32401"}],"wp:attachment":[{"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=27589"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=27589"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kimassi.net\/zak\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=27589"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}