<!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] [2224] trunk: Adding theme options page,
  and ability to show blog posts or activity stream on the front page.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2224</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-12-30 10:15:57 +0000 (Wed, 30 Dec 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Adding theme options page, and ability to show blog posts or activity stream on the front page.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivityphp">trunk/bp-activity.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpthemesbpdefaultcommentsphp">trunk/bp-themes/bp-default/comments.php</a></li>
<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>
<li><a href="#trunkbpthemesbpdefaulthomephp">trunk/bp-themes/bp-default/home.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivityphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-activity.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -105,7 +105,19 @@
</span><span class="cx"> add_action( 'plugins_loaded', 'bp_activity_setup_nav' );
</span><span class="cx"> add_action( 'admin_menu', 'bp_activity_setup_nav' );
</span><span class="cx"> 
</span><ins>+function bp_activity_directory_activity_setup() {
+        global $bp;
</ins><span class="cx"> 
</span><ins>+        if ( $bp-&gt;current_component == $bp-&gt;activity-&gt;slug &amp;&amp; empty( $bp-&gt;current_action ) ) {
+                $bp-&gt;is_directory = true;
+
+                do_action( 'bp_activity_directory_activity_setup' );
+                bp_core_load_template( apply_filters( 'bp_activity_directory_activity_setup', 'activity/index' ) );
+        }
+}
+add_action( 'wp', 'bp_activity_directory_activity_setup', 2 );
+
+
</ins><span class="cx"> /********************************************************************************
</span><span class="cx">  * Screen Functions
</span><span class="cx">  *
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-core/bp-core-templatetags.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -826,15 +826,15 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_is_blog_page() {
</span><del>-        global $bp, $is_member_page;
</del><ins>+        global $bp, $is_member_page, $wp_query;
</ins><span class="cx"> 
</span><span class="cx">         if ( $bp-&gt;current_component == BP_HOME_BLOG_SLUG )
</span><span class="cx">                 return true;
</span><span class="cx"> 
</span><del>-        if ( !$is_member_page &amp;&amp; $bp-&gt;current_component == $bp-&gt;default_component )
</del><ins>+        if ( $wp_query-&gt;is_home &amp;&amp; !$bp-&gt;is_directory )
</ins><span class="cx">                 return true;
</span><span class="cx"> 
</span><del>-        if ( ( !$is_member_page &amp;&amp; !in_array( $bp-&gt;current_component, $bp-&gt;root_components ) ) )
</del><ins>+        if ( !$bp-&gt;displayed_user-&gt;id &amp;&amp; !$bp-&gt;is_single_item &amp;&amp; !$bp-&gt;is_directory )
</ins><span class="cx">                 return true;
</span><span class="cx"> 
</span><span class="cx">         return false;
</span><span class="lines">@@ -890,10 +890,10 @@
</span><span class="cx"> function bp_is_page($page) {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span><del>-        if ( $bp-&gt;displayed_user-&gt;id || $bp-&gt;is_single_item )
-                return false;
</del><ins>+        if ( !$bp-&gt;displayed_user-&gt;id &amp;&amp; $bp-&gt;current_component == $page )
+                return true;
</ins><span class="cx"> 
</span><del>-        if ( $page == $bp-&gt;current_component || ( is_home() &amp;&amp; $page == 'home' &amp;&amp; $bp-&gt;current_component == $bp-&gt;default_component ) || ( $page == BP_MEMBERS_SLUG &amp;&amp; !$bp-&gt;current_component ) )
</del><ins>+        if ( 'home' == $page &amp;&amp; !$bp-&gt;current_component )
</ins><span class="cx">                 return true;
</span><span class="cx"> 
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-core.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> 
</span><span class="cx">         $bp-&gt;core-&gt;table_name_notifications = $wpdb-&gt;base_prefix . 'bp_notifications';
</span><span class="cx"> 
</span><del>-        if ( !$bp-&gt;current_component )
</del><ins>+        if ( !$bp-&gt;current_component &amp;&amp; $bp-&gt;displayed_user-&gt;id )
</ins><span class="cx">                 $bp-&gt;current_component = $bp-&gt;default_component;
</span><span class="cx"> 
</span><span class="cx">         do_action( 'bp_core_setup_globals' );
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultcommentsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/comments.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/comments.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-themes/bp-default/comments.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -24,7 +24,7 @@
</span><span class="cx">                         &lt;?php do_action( 'bp_before_blog_comment_list' ) ?&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;ol class=&quot;commentlist&quot;&gt;
</span><del>-                                &lt;?php wp_list_comments( array( 'callback' =&gt; 'bp_dtheme_comments' ) ); ?&gt;
</del><ins>+                                &lt;?php wp_list_comments( array( 'callback' =&gt; 'bp_dtheme_blog_comments' ) ); ?&gt;
</ins><span class="cx">                         &lt;/ol&gt;&lt;!-- .comment-list --&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php do_action( 'bp_after_blog_comment_list' ) ?&gt;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/functions.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/functions.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-themes/bp-default/functions.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -59,7 +59,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
</span><span class="cx"> 
</span><del>-function bp_dtheme_comments( $comment, $args, $depth ) {
</del><ins>+function bp_dtheme_blog_comments( $comment, $args, $depth ) {
</ins><span class="cx">     $GLOBALS['comment'] = $comment;
</span><span class="cx">         $comment_type = get_comment_type();
</span><span class="cx"> 
</span><span class="lines">@@ -101,6 +101,15 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_dtheme_show_on_frontpage() {
+        $settings = get_option( 'bp_dtheme_options' );
+
+        if ( empty( $settings['show_on_frontpage'] ) || 'blog' == $settings['show_on_frontpage'] )
+                return 'blog';
+
+        return 'activity';
+}
+
</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">@@ -185,4 +194,22 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'init', 'bp_dtheme_remove_redundant' );
</span><span class="cx"> 
</span><ins>+function bp_dtheme_show_notice() { ?&gt;
+        &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
+                &lt;p&gt;&lt;?php printf( __( 'Theme activated! This theme contains &lt;a href=&quot;%s&quot;&gt;customization options&lt;/a&gt; and &lt;a href=&quot;%s&quot;&gt;custom header image&lt;/a&gt; support. &lt;a href=&quot;%s&quot;&gt;Sidebar widgets&lt;/a&gt; are also supported.', 'buddypress' ), '', admin_url( 'themes.php?page=custom-header' ), '' ) ?&gt;&lt;/p&gt;
+        &lt;/div&gt;
+
+        &lt;style type=&quot;text/css&quot;&gt;#message2, #message0 { display: none; }&lt;/style&gt;
+        &lt;?php
+}
+
+/* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
+if ( is_admin() &amp;&amp; isset($_GET['activated'] ) &amp;&amp; $pagenow == &quot;themes.php&quot; ) {
+        add_action( 'admin_notices', 'bp_dtheme_show_notice' );
+}
+
+/* Load the options page */
+if ( is_admin() )
+        require( TEMPLATEPATH . '/_inc/options.php' );
+
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/header.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/header.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-themes/bp-default/header.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -40,29 +40,35 @@
</span><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;li&lt;?php if ( bp_is_page( BP_HOME_BLOG_SLUG ) || bp_is_blog_page() &amp;&amp; !is_front_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;
</del><ins>+                                &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() ) : ?&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;
</ins><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;
-                                        &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;
</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;
+                                        &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;
</ins><span class="cx">                                 &lt;/li&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php if ( function_exists( 'groups_install' ) ) : ?&gt;
</span><span class="cx">                                         &lt;li&lt;?php if ( bp_is_page( BP_GROUPS_SLUG ) || bp_is_group() ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</span><del>-                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_GROUPS_SLUG ?&gt;&quot; title=&quot;&lt;?php _e( 'Groups', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Groups', 'buddypress' ) ?&gt;&lt;/a&gt;
</del><ins>+                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_GROUPS_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Groups', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Groups', 'buddypress' ) ?&gt;&lt;/a&gt;
</ins><span class="cx">                                         &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php if ( function_exists( 'groups_install' ) &amp;&amp; ( function_exists( 'bp_forums_setup' ) &amp;&amp; !(int) get_site_option( 'bp-disable-forum-directory' ) ) ) : ?&gt;
</span><span class="cx">                                         &lt;li&lt;?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</span><del>-                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_FORUMS_SLUG ?&gt;&quot; title=&quot;&lt;?php _e( 'Forums', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Forums', 'buddypress' ) ?&gt;&lt;/a&gt;
</del><ins>+                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_FORUMS_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Forums', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Forums', 'buddypress' ) ?&gt;&lt;/a&gt;
</ins><span class="cx">                                         &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">                                 &lt;?php if ( function_exists( 'bp_blogs_install' ) &amp;&amp; bp_core_is_multiblog_install() ) : ?&gt;
</span><span class="cx">                                         &lt;li&lt;?php if ( bp_is_page( BP_BLOGS_SLUG ) ) : ?&gt; class=&quot;selected&quot;&lt;?php endif; ?&gt;&gt;
</span><del>-                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_BLOGS_SLUG ?&gt;&quot; title=&quot;&lt;?php _e( 'Blogs', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Blogs', 'buddypress' ) ?&gt;&lt;/a&gt;
</del><ins>+                                                &lt;a href=&quot;&lt;?php echo site_url() ?&gt;/&lt;?php echo BP_BLOGS_SLUG ?&gt;/&quot; title=&quot;&lt;?php _e( 'Blogs', 'buddypress' ) ?&gt;&quot;&gt;&lt;?php _e( 'Blogs', 'buddypress' ) ?&gt;&lt;/a&gt;
</ins><span class="cx">                                         &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefaulthomephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/home.php (2223 => 2224)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/home.php        2009-12-30 08:30:49 UTC (rev 2223)
+++ trunk/bp-themes/bp-default/home.php        2009-12-30 10:15:57 UTC (rev 2224)
</span><span class="lines">@@ -1,3 +1,10 @@
</span><span class="cx"> &lt;?php
</span><del>-        locate_template( array( 'activity/index.php' ), true );
</del><ins>+        /***
+         * 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 ( 'blog' == bp_dtheme_show_on_frontpage() )
+                locate_template( array( 'index.php' ), true );
+        else
+                locate_template( array( 'activity/index.php' ), true );
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>