<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][4536] trunk: Rework page &lt;title&gt; generation to use WP's wp_title().</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>4536</dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2011-06-19 17:29:51 +0000 (Sun, 19 Jun 2011)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rework page &lt;title&gt; generation to use WP's wp_title(). Fixes #2598</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcorefiltersphp">trunk/bp-core/bp-core-filters.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatephp">trunk/bp-core/bp-core-template.php</a></li>
<li><a href="#trunkbpcoredeprecated13php">trunk/bp-core/deprecated/1.3.php</a></li>
<li><a href="#trunkbpforumsbpforumsfiltersphp">trunk/bp-forums/bp-forums-filters.php</a></li>
<li><a href="#trunkbpthemesbpdefaultheaderphp">trunk/bp-themes/bp-default/header.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcorefiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-filters.php (4535 => 4536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-filters.php        2011-06-19 16:30:58 UTC (rev 4535)
+++ trunk/bp-core/bp-core-filters.php        2011-06-19 17:29:51 UTC (rev 4536)
</span><span class="lines">@@ -251,4 +251,71 @@
</span><span class="cx"> if ( !is_admin() || ( is_admin() &amp;&amp; empty( $_POST['noconfirmation'] ) ) )
</span><span class="cx">         add_filter( 'wpmu_signup_user_notification', 'bp_core_activation_signup_user_notification', 1, 4 );
</span><span class="cx"> 
</span><ins>+/**
+ * Filter the page title for BuddyPress pages
+ *
+ * @global object $bp BuddyPress global settings
+ * @global unknown $post
+ * @global WP_Query $wp_query WordPress query object
+ * @param string $title Original page title
+ * @param string $sep How to separate the various items within the page title.
+ * @param string $seplocation Direction to display title
+ * @return string new page title
+ * @see wp_title()
+ * @since 1.3
+ */
+function bp_modify_page_title( $title, $sep, $seplocation ) {
+        global $bp, $post, $wp_query;
+
+        if ( bp_is_blog_page() )
+                return $title;
+
+        $title = '';
+
+        // Displayed user
+        if ( !empty( $bp-&gt;displayed_user-&gt;fullname ) &amp;&amp; !is_404() ) {
+                // translators: &quot;displayed user's name | canonicalised component name&quot;
+                $title = strip_tags( sprintf( __( '%1$s | %2$s', 'buddypress' ), bp_get_displayed_user_fullname(), ucwords( bp_current_component() ) ) ); 
+
+        // A single group
+        } elseif ( bp_is_active( 'groups' ) &amp;&amp; !empty( $bp-&gt;groups-&gt;current_group ) &amp;&amp; !empty( $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug] ) ) {
+                $subnav = isset( $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug][$bp-&gt;current_action]['name'] ) ? $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug][$bp-&gt;current_action]['name'] : '';
+                // translators: &quot;group name | group nav section name&quot;
+                $title = sprintf( __( '%1$s | %2$s', 'buddypress' ), $bp-&gt;bp_options_title, $subnav );
+
+        // A single item from a component other than groups
+        } elseif ( bp_is_single_item() ) {
+                // translators: &quot;root component name | component item name | component nav section name&quot;
+                $title = sprintf( __( '%1$s | %2$s | %3$s', 'buddypress' ), bp_get_name_from_root_slug(), $bp-&gt;bp_options_title, $bp-&gt;bp_options_nav[$bp-&gt;current_component][$bp-&gt;current_action]['name'] );
+
+        // An index or directory
+        } elseif ( bp_is_directory() ) {
+                if ( !bp_current_component() )
+                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( $bp-&gt;members-&gt;slug ) );
+                else
+                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );
+
+        // Sign up page
+        } elseif ( bp_is_register_page() ) {
+                $title = __( 'Create an Account', 'buddypress' );
+
+        // Activation page
+        } elseif ( bp_is_activation_page() ) {
+                $title = __( 'Activate your Account', 'buddypress' );
+
+        // Group creation page
+        } elseif ( bp_is_group_create() ) {
+                $title = __( 'Create a Group', 'buddypress' );
+
+        // Blog creation page
+        } elseif ( bp_is_create_blog() ) {
+                $title = __( 'Create a Site', 'buddypress' );
+        }
+
+        return apply_filters( 'bp_modify_page_title', $title . &quot; $sep &quot;, $title, $sep, $seplocation );
+}
+add_filter( 'wp_title', 'bp_modify_page_title', 10, 3 );
+add_filter( 'bp_modify_page_title', 'wptexturize'   );
+add_filter( 'bp_modify_page_title', 'convert_chars' );
+add_filter( 'bp_modify_page_title', 'esc_html'      );
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-template.php (4535 => 4536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-template.php        2011-06-19 16:30:58 UTC (rev 4535)
+++ trunk/bp-core/bp-core-template.php        2011-06-19 17:29:51 UTC (rev 4536)
</span><span class="lines">@@ -213,86 +213,6 @@
</span><span class="cx">         locate_template( array( 'plugin-sidebar.php' ), true );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function bp_page_title() {
-        echo bp_get_page_title();
-}
-
-function bp_get_page_title() {
-        global $bp, $post, $wp_query;
-
-        $title = '';
-
-        // Home
-        if ( is_front_page() || ( is_home() &amp;&amp; bp_is_page( 'home' ) ) ) {
-                $title = _x( 'Home', 'Home page title', 'buddypress' );
-
-        // Blog
-        } elseif ( bp_is_blog_page() ) {
-                if ( is_single() ) {
-                        $title = sprintf( __( 'Site &amp;#124; %s', 'buddypress' ), $post-&gt;post_title );
-                } else if ( is_category() ) {
-                        $title = sprintf( __( 'Site &amp;#124; Categories &amp;#124; %s', 'buddypress' ), ucwords( $wp_query-&gt;query_vars['category_name'] ) );
-                } else if ( is_tag() ) {
-                        $title = sprintf( __( 'Site &amp;#124; Tags &amp;#124; %s', 'buddypress' ), ucwords( $wp_query-&gt;query_vars['tag'] ) );
-                } else if ( is_page() ){
-                        $title = $post-&gt;post_title;
-                } else
-                        $title = __( 'Site', 'buddypress' );
-
-        // Displayed user
-        } elseif ( !empty( $bp-&gt;displayed_user-&gt;fullname ) &amp;&amp; !is_404() ) {
-                // translators: &quot;displayed user's name | canonicalised component name&quot;
-                $title = strip_tags( sprintf( __( '%1$s &amp;#124; %2$s', 'buddypress' ), $bp-&gt;displayed_user-&gt;fullname, ucwords( bp_current_component() ) ) ); 
-
-        // A single group
-        } elseif ( bp_is_active( 'groups' ) &amp;&amp; !empty( $bp-&gt;groups-&gt;current_group ) &amp;&amp; !empty( $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug] ) ) {
-                $subnav = isset( $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug][$bp-&gt;current_action]['name'] ) ? $bp-&gt;bp_options_nav[$bp-&gt;groups-&gt;current_group-&gt;slug][$bp-&gt;current_action]['name'] : '';
-                // translators: &quot;group name | group nav section name&quot;
-                $title = sprintf( __( '%1$s &amp;#124; %2$s', 'buddypress' ), $bp-&gt;bp_options_title, $subnav );
-
-        // A single item from a component other than groups
-        } elseif ( bp_is_single_item() ) {
-                // translators: &quot;root component name | component item name | component nav section name&quot;
-                $title = sprintf( __( '%1$s &amp;#124; %2$s &amp;#124; %3$s', 'buddypress' ), bp_get_name_from_root_slug(), $bp-&gt;bp_options_title, $bp-&gt;bp_options_nav[$bp-&gt;current_component][$bp-&gt;current_action]['name'] );
-
-        // An index or directory
-        } elseif ( bp_is_directory() ) {
-                if ( !bp_current_component() )
-                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug( $bp-&gt;members-&gt;slug ) );
-                else
-                        $title = sprintf( __( '%s Directory', 'buddypress' ), bp_get_name_from_root_slug() );
-
-        // Sign up page
-        } elseif ( bp_is_register_page() ) {
-                $title = __( 'Create an Account', 'buddypress' );
-
-        // Activation page
-        } elseif ( bp_is_activation_page() ) {
-                $title = __( 'Activate your Account', 'buddypress' );
-
-        // Group creation page
-        } elseif ( bp_is_group_create() ) {
-                $title = __( 'Create a Group', 'buddypress' );
-
-        // Blog creation page
-        } elseif ( bp_is_create_blog() ) {
-                $title = __( 'Create a Site', 'buddypress' );
-        }
-
-        $site_title = get_bloginfo( 'name', 'display' );
-
-        // Filter the title
-        if ( !empty( $title ) )
-                $site_title .= ' &amp;#124; ' . $title;
-
-        return apply_filters( 'bp_page_title', esc_attr( $site_title ), esc_attr( $site_title ) );
-}
-
-function bp_styles() {
-        do_action( 'bp_styles' );
-        wp_print_styles();
-}
-
</del><span class="cx"> /** Search Form ***************************************************************/
</span><span class="cx"> 
</span><span class="cx"> function bp_search_form_action() {
</span></span></pre></div>
<a id="trunkbpcoredeprecated13php"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/deprecated/1.3.php (4535 => 4536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/deprecated/1.3.php        2011-06-19 16:30:58 UTC (rev 4535)
+++ trunk/bp-core/deprecated/1.3.php        2011-06-19 17:29:51 UTC (rev 4536)
</span><span class="lines">@@ -382,7 +382,39 @@
</span><span class="cx">         return apply_filters( 'bp_search_form_enabled', true );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/**
+ * Template tag version of bp_get_page_title()
+ *
+ * @deprecated 1.3
+ * @deprecated Use wp_title()
+ * @since 1.0
+ */
+function bp_page_title() {
+        echo bp_get_page_title(); 
+}
+        /**
+         * Prior to BuddyPress 1.3, this was used to generate the page's &lt;title&gt; text.
+         * Now, just simply use wp_title().
+         *
+         * @deprecated 1.3
+         * @deprecated Use wp_title()
+         * @since 1.0
+         */
+        function bp_get_page_title() {
+                _deprecated_function( __FUNCTION__, '1.3', 'wp_title()' );
+                $title = wp_title( '|', false, 'right' ) . get_bloginfo( 'name', 'display' );
</ins><span class="cx"> 
</span><ins>+                // Backpat for BP 1.2 filter
+                $title = apply_filters( 'bp_page_title', esc_attr( $title ), esc_attr( $title ) );
+
+                return apply_filters( 'bp_get_page_title', $title );
+        }
+
+function bp_styles() {
+        do_action( 'bp_styles' );
+        wp_print_styles();
+}
+
</ins><span class="cx"> /** Theme *********************************************************************/
</span><span class="cx"> 
</span><span class="cx"> /**
</span></span></pre></div>
<a id="trunkbpforumsbpforumsfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-filters.php (4535 => 4536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-filters.php        2011-06-19 16:30:58 UTC (rev 4535)
+++ trunk/bp-forums/bp-forums-filters.php        2011-06-19 17:29:51 UTC (rev 4536)
</span><span class="lines">@@ -94,19 +94,23 @@
</span><span class="cx">  * Append forum topic to page title
</span><span class="cx">  *
</span><span class="cx">  * @global object $bp
</span><del>- * @param string $title
</del><ins>+ * @param string $title New page title; see bp_modify_page_title()
+ * @param string $title Original page title
+ * @param string $sep How to separate the various items within the page title.
+ * @param string $seplocation Direction to display title
</ins><span class="cx">  * @return string
</span><ins>+ * @see bp_modify_page_title()
</ins><span class="cx">  */
</span><del>-function bp_forums_add_forum_topic_to_page_title( $title ) {
</del><ins>+function bp_forums_add_forum_topic_to_page_title( $title, $original_title, $sep, $seplocation  ) {
</ins><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="cx">         if ( $bp-&gt;current_action == 'forum' &amp;&amp; !empty( $bp-&gt;action_variables[0] ) &amp;&amp; 'topic' == $bp-&gt;action_variables[0] )
</span><span class="cx">                 if ( bp_has_forum_topic_posts() )
</span><del>-                        $title .= ' &amp;#124; ' . bp_get_the_topic_title();
</del><ins>+                        $title .= bp_get_the_topic_title() . &quot; $sep &quot;;
</ins><span class="cx"> 
</span><span class="cx">         return $title;
</span><span class="cx"> }
</span><del>-add_filter( 'bp_page_title', 'bp_forums_add_forum_topic_to_page_title' );
</del><ins>+add_filter( 'bp_modify_page_title', 'bp_forums_add_forum_topic_to_page_title', 9, 4 );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * bp_forums_strip_mentions_on_post_edit( $title )
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/header.php (4535 => 4536)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/header.php        2011-06-19 16:30:58 UTC (rev 4535)
+++ trunk/bp-themes/bp-default/header.php        2011-06-19 17:29:51 UTC (rev 4536)
</span><span class="lines">@@ -3,7 +3,7 @@
</span><span class="cx"> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &lt;?php language_attributes(); ?&gt;&gt;
</span><span class="cx">         &lt;head profile=&quot;http://gmpg.org/xfn/11&quot;&gt;
</span><span class="cx">                 &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;&lt;?php bloginfo( 'html_type' ) ?&gt;; charset=&lt;?php bloginfo( 'charset' ) ?&gt;&quot; /&gt;
</span><del>-                &lt;title&gt;&lt;?php bp_page_title() ?&gt;&lt;/title&gt;
</del><ins>+                &lt;title&gt;&lt;?php wp_title( '|', true, 'right' ); bloginfo( 'name' ); ?&gt;&lt;/title&gt;
</ins><span class="cx">                 &lt;link rel=&quot;stylesheet&quot; href=&quot;&lt;?php bloginfo( 'stylesheet_url') ?&gt;&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;?php do_action( 'bp_head' ) ?&gt;
</span></span></pre>
</div>
</div>

</body>
</html>