<!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 "Forums" 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->ID == $bp->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->permalink_structure ) ) { ?>
+                <div id="message" class="updated fade">
+                        <p><?php printf( __( '<strong>BuddyPress is almost ready</strong>. You must <a href="%s">update your permalink structure</a> to something other than the default for it to work.', 'buddypress' ), admin_url( 'options-permalink.php' ) ) ?></p>
+                </div><?php
+        } else {
+                if ( !in_array( 'buddypress', (array)$ct->tags ) ) { ?>
+                        <div id="message" class="updated fade">
+                                <p style="line-height: 150%"><?php printf( __( "<strong>BuddyPress is ready</strong>. You'll need to <a href='%s'>activate a BuddyPress compatible theme</a> to take advantage of all of the features. We've bundled a default theme, but you can always <a href='%s'>install some other compatible themes</a>.", 'buddypress' ), admin_url( 'themes.php' ), admin_url( 'theme-install.php?type=tag&s=buddypress&tab=search' ) ) ?></p>
+                        </div><?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' => $_POST['topic_group_id'] ) ) ) {
</del><ins>+                        if ( $bp->groups->current_group = groups_get_group( array( 'group_id' => $_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() && 'public' == $group->status && !groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
-                                        groups_join_group( $group->id, $group->id );
</del><ins>+                                if ( !is_site_admin() && 'public' == $bp->groups->current_group->status && !groups_is_user_member( $bp->loggedin_user->id, $bp->groups->current_group->id ) )
+                                        groups_join_group( $bp->groups->current_group->id, $bp->groups->current_group->id );
</ins><span class="cx">
</span><del>-                                if ( $forum_id = groups_get_groupmeta( $group->id, 'forum_id' ) ) {
</del><ins>+                                if ( $forum_id = groups_get_groupmeta( $bp->groups->current_group->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->topic_slug . '/' );
</del><ins>+                                        bp_core_redirect( bp_get_group_permalink( $bp->groups->current_group ) . '/forum/topic/' . $topic->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">                                         </li>
</span><span class="cx">                                 <?php endif; ?>
</span><span class="cx">
</span><del>-                                <?php if ( function_exists( 'groups_install' ) && ( function_exists( 'bp_forums_setup' ) && !(int) get_site_option( 'bp-disable-forum-directory' ) ) ) : ?>
</del><ins>+                                <?php if ( function_exists( 'groups_install' ) && ( function_exists( 'bp_forums_is_installed_correctly' ) && !(int) get_site_option( 'bp-disable-forum-directory' ) ) && bp_forums_is_installed_correctly() ) : ?>
</ins><span class="cx">                                         <li<?php if ( bp_is_page( BP_FORUMS_SLUG ) ) : ?> class="selected"<?php endif; ?>>
</span><span class="cx">                                                 <a href="<?php echo site_url() ?>/<?php echo BP_FORUMS_SLUG ?>/" title="<?php _e( 'Forums', 'buddypress' ) ?>"><?php _e( 'Forums', 'buddypress' ) ?></a>
</span><span class="cx">                                         </li>
</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>