<!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" /><style type="text/css"><!--
#msg dl { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer { 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 #fc0 solid; padding: 6px; }
#msg ul, pre { overflow: auto; }
#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>
<title>[BuddyPress] [2612] trunk/bp-themes/bp-default:
  Removing theme options and moving the option to show the activity stream on the front page to the normal WordPress Settings 
 &gt; Reading menu.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2612</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-07 00:22:22 +0000 (Sun, 07 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Removing theme options and moving the option to show the activity stream on the front page to the normal WordPress Settings &gt; Reading menu. This stops problems caused when choosing a static WordPress page as the front page.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpthemesbpdefaultfunctionsphp">trunk/bp-themes/bp-default/functions.php</a></li>
<li><a href="#trunkbpthemesbpdefaultheaderphp">trunk/bp-themes/bp-default/header.php</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkbpthemesbpdefaulthomephp">trunk/bp-themes/bp-default/home.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/functions.php (2611 => 2612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/functions.php        2010-02-06 14:11:07 UTC (rev 2611)
+++ trunk/bp-themes/bp-default/functions.php        2010-02-07 00:22:22 UTC (rev 2612)
</span><span class="lines">@@ -21,25 +21,6 @@
</span><span class="cx"> /* Load the javascript for the theme */
</span><span class="cx"> wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
</span><span class="cx"> 
</span><del>-/* Make sure the blog index page shows under /[HOME_BLOG_SLUG] if enabled */
-function bp_dtheme_show_home_blog() {
-        global $bp, $query_string, $paged;
-
-        if ( $bp-&gt;current_component == BP_HOME_BLOG_SLUG &amp;&amp; ( !$bp-&gt;current_action || 'page' == $bp-&gt;current_action ) ) {
-                unset( $query_string );
-
-                if ( ( 'page' == $bp-&gt;current_action &amp;&amp; $bp-&gt;action_variables[0] ) &amp;&amp; false === strpos( $query_string, 'paged' ) ) {
-                        $query_string .= '&amp;paged=' . $bp-&gt;action_variables[0];
-                        $paged = $bp-&gt;action_variables[0];
-                }
-
-                query_posts($query_string);
-
-                bp_core_load_template( 'index', true );
-        }
-}
-add_action( 'wp', 'bp_dtheme_show_home_blog', 2 );
-
</del><span class="cx"> function bp_dtheme_firstname( $name = false, $echo = false ) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><span class="lines">@@ -100,15 +81,47 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-function bp_dtheme_show_on_frontpage() {
-        $settings = get_option( 'bp_dtheme_options' );
</del><ins>+function bp_dtheme_wp_pages_filter( $page_html ) {
+        if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
+                return $page_html;
</ins><span class="cx"> 
</span><del>-        if ( empty( $settings['show_on_frontpage'] ) || 'blog' == $settings['show_on_frontpage'] )
-                return apply_filters( 'bp_dtheme_show_on_frontpage', 'blog' );
</del><ins>+        $selected = false;
+        $page_html = str_replace( '&lt;/select&gt;', '', $page_html );
</ins><span class="cx"> 
</span><del>-        return apply_filters( 'bp_dtheme_show_on_frontpage', 'activity' );
</del><ins>+        if ( bp_dtheme_page_on_front() == 'activity' )
+                $selected = ' selected=&quot;selected&quot;';
+
+        $page_html .= '&lt;option class=&quot;level-0&quot; value=&quot;activity&quot;' . $selected . '&gt;' . __( 'Activity Stream', 'buddypress' ) . '&lt;/option&gt;&lt;/select&gt;';
+        return $page_html;
</ins><span class="cx"> }
</span><ins>+add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
</ins><span class="cx"> 
</span><ins>+function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
+        if ( !is_admin() || !is_site_admin() )
+                return false;
+
+        if ( 'activity' == $_POST['page_on_front'] )
+                return 'activity';
+        else
+                return $oldvalue;
+}
+add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
+
+function bp_dtheme_page_on_front_template( $template ) {
+        global $wp_query;
+
+        if ( empty( $wp_query-&gt;post-&gt;ID ) )
+                return locate_template( array( 'activity/index.php' ), false );
+        else
+                return $template;
+}
+add_filter( 'page_template', 'bp_dtheme_page_on_front_template' );
+
+/* Return the ID of a page set as the home page. */
+function bp_dtheme_page_on_front() {
+        return apply_filters( 'bp_dtheme_page_on_front', get_option( 'page_on_front' ) );
+}
+
</ins><span class="cx"> /* Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/) */
</span><span class="cx"> define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
</span><span class="cx"> define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
</span><span class="lines">@@ -219,17 +232,13 @@
</span><span class="cx">         add_action( 'admin_notices', 'bp_dtheme_show_notice' );
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-/* Load the options page */
-if ( is_admin() )
-        require( TEMPLATEPATH . '/_inc/options.php' );
-
</del><span class="cx"> /* Adjust home page body class if activity stream is home */
</span><span class="cx"> function bp_dtheme_body_class_home( $classes, $bp_classes, $wp_classes, $custom_classes ) {
</span><span class="cx">         if ( !is_home() )
</span><span class="cx">                 return apply_filters( 'bp_dtheme_body_class_home', $classes, $bp_classes, $wp_classes, $custom_classes );
</span><span class="cx"> 
</span><span class="cx">         if ( bp_is_active( 'activity' ) ) {
</span><del>-                if ( 'activity' == bp_dtheme_show_on_frontpage() ) {
</del><ins>+                if ( 'activity' == bp_dtheme_page_on_front() ) {
</ins><span class="cx">                         $blog = array_keys( $classes, 'blog-page' );
</span><span class="cx">                         $classes[$blog[0]] = 'activity';
</span><span class="cx">                         $classes[] = 'directory';
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/header.php (2611 => 2612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/header.php        2010-02-06 14:11:07 UTC (rev 2611)
+++ trunk/bp-themes/bp-default/header.php        2010-02-07 00:22:22 UTC (rev 2612)
</span><span class="lines">@@ -44,23 +44,17 @@
</span><span class="cx">                         &lt;h1 id=&quot;logo&quot;&gt;&lt;a href=&quot;&lt;?php echo site_url() ?&gt;&quot; title=&quot;&lt;?php _e( 'Home', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php bp_site_name() ?&gt;&lt;/a&gt;&lt;/h1&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;ul id=&quot;nav&quot;&gt;
</span><del>-                                &lt;li&lt;?php if ( bp_is_page( 'home' ) &amp;&amp; !is_page() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</del><ins>+                                &lt;li&lt;?php if ( is_front_page() || !bp_current_component() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</ins><span class="cx">                                         &lt;a href=&quot;&lt;?php echo site_url() ?&gt;&quot; title=&quot;&lt;?php _e( 'Home', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Home', 'buddypress' ) ?&gt;&lt;/a&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><del>-                                &lt;?php if ( bp_is_active( 'activity' ) ) : ?&gt;
-                                        &lt;?php if ( 'blog' == bp_dtheme_show_on_frontpage() ) : ?&gt;
-                                                &lt;li&lt;?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
-                                                        &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_ACTIVITY_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Activity', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Activity', 'buddypress' ) ?&gt;&lt;/a&gt;
-                                                &lt;/li&gt;
-                                        &lt;?php else : ?&gt;
-                                                &lt;li&lt;?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() &amp;&amp; !is_front_page() &amp;&amp; !is_page() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
-                                                        &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_HOME_BLOG_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Blog', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Blog', 'buddypress' ) ?&gt;&lt;/a&gt;
-                                                &lt;/li&gt;
-                                        &lt;?php endif; ?&gt;
</del><ins>+                                &lt;?php if ( 'activity' != bp_dtheme_page_on_front() &amp;&amp; bp_is_active( 'activity' ) ) : ?&gt;
+                                        &lt;li&lt;?php if ( bp_is_page( BP_ACTIVITY_SLUG ) ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
+                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_ACTIVITY_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Activity', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Activity', 'buddypress' ) ?&gt;&lt;/a&gt;
+                                        &lt;/li&gt;
</ins><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;li&lt;?php if (  bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</del><ins>+                                &lt;li&lt;?php if ( bp_is_page( BP_MEMBERS_SLUG ) || bp_is_member() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</ins><span class="cx">                                         &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_MEMBERS_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Members', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Members', 'buddypress' ) ?&gt;&lt;/a&gt;
</span><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -82,7 +76,7 @@
</span><span class="cx">                                         &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><del>-                                &lt;?php wp_list_pages( 'title_li=&amp;depth=1' ); ?&gt;
</del><ins>+                                &lt;?php wp_list_pages( 'title_li=&amp;depth=1&amp;exclude=' . bp_dtheme_page_on_front() ); ?&gt;
</ins><span class="cx"> 
</span><span class="cx">                                 &lt;?php do_action( 'bp_nav_items' ); ?&gt;
</span><span class="cx">                         &lt;/ul&gt;&lt;!-- #nav --&gt;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaulthomephp"></a>
<div class="delfile"><h4>Deleted: trunk/bp-themes/bp-default/home.php (2611 => 2612)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/home.php        2010-02-06 14:11:07 UTC (rev 2611)
+++ trunk/bp-themes/bp-default/home.php        2010-02-07 00:22:22 UTC (rev 2612)
</span><span class="lines">@@ -1,14 +0,0 @@
</span><del>-&lt;?php
-        /***
-         * Should we show the blog on the front page, or the activity stream?
-         * This is set in wp-admin &gt; Appearance &gt; Theme Options
-         */
-        if ( !bp_is_active( 'activity' ) )
-                locate_template( array( 'index.php' ), true );
-        else {
-                if ( 'blog' == bp_dtheme_show_on_frontpage() )
-                        locate_template( array( 'index.php' ), true );
-                else
-                        locate_template( array( 'activity/index.php' ), true );
-        }
-?&gt;
</del><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>