<!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] [2239] trunk:
  Added helpful messages when first installing and activating BuddyPress.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2239</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-01-01 16:01:13 +0000 (Fri, 01 Jan 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Added helpful messages when first installing and activating BuddyPress. 
Auto enabled BuddyPress themes for selection on the root blog in multiblog installations. 
Made &quot;Forums&quot; tab hidden until the forums are set up correctly.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorephp">trunk/bp-core.php</a></li>
<li><a href="#trunkbpforumsphp">trunk/bp-forums.php</a></li>
<li><a href="#trunkbploaderphp">trunk/bp-loader.php</a></li>
<li><a href="#trunkbpthemesbpclassicstylecss">trunk/bp-themes/bp-classic/style.css</a></li>
<li><a href="#trunkbpthemesbpdefaultheaderphp">trunk/bp-themes/bp-default/header.php</a></li>
<li><a href="#trunkbpthemesbpdefaultstylecss">trunk/bp-themes/bp-default/style.css</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-core.php        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -1896,6 +1896,63 @@
</span><span class="cx"> add_filter( 'admin_menu', 'bp_core_filter_parent_theme' );
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * bp_core_allow_default_theme()
+ *
+ * On multiblog installations you must first allow themes to be activated and show
+ * up on the theme selection screen. This function will let the BuddyPress bundled
+ * themes show up on the root blog selection screen and bypass this step. It also
+ * means that the themes won't show for selection on other blogs.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_allow_default_theme( $themes ) {
+        global $bp, $current_blog;
+
+        if ( $current_blog-&gt;ID == $bp-&gt;root_blog ) {
+                $themes['bp-default'] = 1;
+                $themes['bp-classic'] = 1;
+        }
+
+        return $themes;
+}
+add_filter( 'allowed_themes', 'bp_core_allow_default_theme' );
+
+/**
+ * bp_core_activation_notice()
+ *
+ * When BuddyPress is activated we must make sure that mod_rewrite is enabled.
+ * We must also make sure a BuddyPress compatible theme is enabled. This function
+ * will show helpful messages to the administrator.
+ *
+ * @package BuddyPress Core
+ */
+function bp_core_activation_notice() {
+        global $wp_rewrite;
+
+        if ( isset( $_POST['permalink_structure'] ) )
+                return false;
+
+        if ( !is_site_admin() )
+                return false;
+
+        /* Get current theme info */
+        $ct = current_theme_info();
+
+        if ( empty( $wp_rewrite-&gt;permalink_structure ) ) { ?&gt;
+                &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
+                        &lt;p&gt;&lt;?php printf( __( '&lt;strong&gt;BuddyPress is almost ready&lt;/strong&gt;. You must &lt;a href=&quot;%s&quot;&gt;update your permalink structure&lt;/a&gt; to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ?&gt;&lt;/p&gt;
+                &lt;/div&gt;&lt;?php
+        } else {
+                if ( !in_array( 'buddypress', (array)$ct-&gt;tags ) ) { ?&gt;
+                        &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
+                                &lt;p style=&quot;line-height: 150%&quot;&gt;&lt;?php printf( __( &quot;&lt;strong&gt;BuddyPress is ready&lt;/strong&gt;. You'll need to &lt;a href='%s'&gt;activate a BuddyPress compatible theme&lt;/a&gt; to take advantage of all of the features. We've bundled a default theme, but you can always &lt;a href='%s'&gt;install some other compatible themes&lt;/a&gt;.&quot;, 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&amp;s=buddypress&amp;tab=search' ) ) ?&gt;&lt;/p&gt;
+                        &lt;/div&gt;&lt;?php
+                }
+        }
+}
+add_action( 'admin_notices', 'bp_core_activation_notice' );
+
+/**
</ins><span class="cx">  * bp_core_clear_user_object_cache()
</span><span class="cx">  *
</span><span class="cx">  * Clears all cached objects for a user, or a user is part of.
</span></span></pre></div>
<a id="trunkbpforumsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums.php (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums.php        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-forums.php        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -67,18 +67,18 @@
</span><span class="cx">                         /* Check the nonce */
</span><span class="cx">                         check_admin_referer( 'bp_forums_new_topic' );
</span><span class="cx"> 
</span><del>-                        if ( $group = groups_get_group( array( 'group_id' =&gt; $_POST['topic_group_id'] ) ) ) {
</del><ins>+                        if ( $bp-&gt;groups-&gt;current_group = groups_get_group( array( 'group_id' =&gt; $_POST['topic_group_id'] ) ) ) {
</ins><span class="cx">                                 /* Auto join this user if they are not yet a member of this group */
</span><del>-                                if ( !is_site_admin() &amp;&amp; 'public' == $group-&gt;status &amp;&amp; !groups_is_user_member( $bp-&gt;loggedin_user-&gt;id, $group-&gt;id ) )
-                                        groups_join_group( $group-&gt;id, $group-&gt;id );
</del><ins>+                                if ( !is_site_admin() &amp;&amp; 'public' == $bp-&gt;groups-&gt;current_group-&gt;status &amp;&amp; !groups_is_user_member( $bp-&gt;loggedin_user-&gt;id, $bp-&gt;groups-&gt;current_group-&gt;id ) )
+                                        groups_join_group( $bp-&gt;groups-&gt;current_group-&gt;id, $bp-&gt;groups-&gt;current_group-&gt;id );
</ins><span class="cx"> 
</span><del>-                                if ( $forum_id = groups_get_groupmeta( $group-&gt;id, 'forum_id' ) ) {
</del><ins>+                                if ( $forum_id = groups_get_groupmeta( $bp-&gt;groups-&gt;current_group-&gt;id, 'forum_id' ) ) {
</ins><span class="cx">                                         if ( !$topic = groups_new_group_forum_topic( $_POST['topic_title'], $_POST['topic_text'], $_POST['topic_tags'], $forum_id ) )
</span><span class="cx">                                                 bp_core_add_message( __( 'There was an error when creating the topic', 'buddypress'), 'error' );
</span><span class="cx">                                         else
</span><span class="cx">                                                 bp_core_add_message( __( 'The topic was created successfully', 'buddypress') );
</span><span class="cx"> 
</span><del>-                                        bp_core_redirect( bp_get_group_permalink( $group ) . '/forum/topic/' . $topic-&gt;topic_slug . '/' );
</del><ins>+                                        bp_core_redirect( bp_get_group_permalink( $bp-&gt;groups-&gt;current_group ) . '/forum/topic/' . $topic-&gt;topic_slug . '/' );
</ins><span class="cx">                                 }
</span><span class="cx">                         }
</span><span class="cx">                 }
</span></span></pre></div>
<a id="trunkbploaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-loader.php (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-loader.php        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-loader.php        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -56,6 +56,9 @@
</span><span class="cx">         /* Force refresh theme roots. */
</span><span class="cx">         delete_site_transient( 'theme_roots' );
</span><span class="cx"> 
</span><ins>+        /* Show activation notice with some setup instructions */
+        add_action( 'admin_notices', 'bp_core_activation_notice' );
+
</ins><span class="cx">         do_action( 'bp_loader_activate' );
</span><span class="cx"> }
</span><span class="cx"> register_activation_hook( __FILE__, 'bp_loader_activate' );
</span></span></pre></div>
<a id="trunkbpthemesbpclassicstylecss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-classic/style.css (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-classic/style.css        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-themes/bp-classic/style.css        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -5,7 +5,7 @@
</span><span class="cx"> Version: 1.2-rare
</span><span class="cx"> Author: BuddyPress.org
</span><span class="cx"> Author URI: http://buddypress.org
</span><del>-Tags: buddypress, three-columns, white, orange, flexible-width
</del><ins>+Tags: buddypress, three-columns, white, orange
</ins><span class="cx"> Template: bp-sn-parent
</span><span class="cx"> */
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/header.php (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/header.php        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-themes/bp-default/header.php        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">                                         &lt;/li&gt;
</span><span class="cx">                                 &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><del>-                                &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;
</del><ins>+                                &lt;?php if ( function_exists( 'groups_install' ) &amp;&amp; ( function_exists( 'bp_forums_is_installed_correctly' ) &amp;&amp; !(int) get_site_option( 'bp-disable-forum-directory' ) ) &amp;&amp; bp_forums_is_installed_correctly() ) : ?&gt;
</ins><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><span class="cx">                                                 &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;
</span><span class="cx">                                         &lt;/li&gt;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultstylecss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/style.css (2238 => 2239)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/style.css        2010-01-01 14:11:09 UTC (rev 2238)
+++ trunk/bp-themes/bp-default/style.css        2010-01-01 16:01:13 UTC (rev 2239)
</span><span class="lines">@@ -5,6 +5,7 @@
</span><span class="cx"> Version: 1.2-rare
</span><span class="cx"> Author: BuddyPress.org
</span><span class="cx"> Author URI: http://buddypress.org
</span><ins>+Tags: buddypress, two-columns, custom-header, white, blue
</ins><span class="cx"> */
</span><span class="cx"> 
</span><span class="cx"> /***
</span></span></pre>
</div>
</div>

</body>
</html>