<!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][6108] trunk: Reinstates 1.5.x integration of bbPress 1.x forum installation and configuration</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><a href="http://buddypress.trac.wordpress.org/changeset/6108">6108</a></dd>
<dt>Author</dt> <dd>boonebgorges</dd>
<dt>Date</dt> <dd>2012-06-18 13:06:13 +0000 (Mon, 18 Jun 2012)</dd>
</dl>
<h3>Log Message</h3>
<pre>Reinstates 1.5.x integration of bbPress 1.x forum installation and configuration
In anticipation for a full switchover to bbPress 2.x in BuddyPress 1.6, several
aspects of the forum configuration and setup process were modified. Since
the migration to bbPress 2.x is being put off to a later version of BuddyPress,
it's necessary to revert some of these changes back to their BP 1.5.x state.
This changeset also fixes a bug in the bb-config.php creation script, where
a salt containing the string '?>' could result in early termination of the
config file.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/4269">#4269</a></pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcoreadminbpcorefunctionsphp">trunk/bp-core/admin/bp-core-functions.php</a></li>
<li><a href="#trunkbpcoreadminbpcoreupdatephp">trunk/bp-core/admin/bp-core-update.php</a></li>
<li><a href="#trunkbpforumsbpforumsadminphp">trunk/bp-forums/bp-forums-admin.php</a></li>
<li><a href="#trunkbpforumsbpforumsfunctionsphp">trunk/bp-forums/bp-forums-functions.php</a></li>
<li><a href="#trunkbpforumsbpforumsloaderphp">trunk/bp-forums/bp-forums-loader.php</a></li>
<li><a href="#trunkbpthemesbpdefaultgroupscreatephp">trunk/bp-themes/bp-default/groups/create.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcoreadminbpcorefunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/admin/bp-core-functions.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/admin/bp-core-functions.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-core/admin/bp-core-functions.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -365,8 +365,8 @@
</span><span class="cx">                 )
</span><span class="cx">         );
</span><span class="cx">
</span><del>-        // If forums component is active and bbPress 1.x is in use add additional tab
-        if ( bp_is_active( 'forums' ) && bp_forums_is_repair() ) {
</del><ins>+        // If forums component is active, add additional tab
+        if ( bp_is_active( 'forums' ) ) {
</ins><span class="cx">                 $tabs['3'] = array(
</span><span class="cx">                         'href' => bp_get_admin_url( add_query_arg( array( 'page' => 'bb-forums-setup' ), 'admin.php' ) ),
</span><span class="cx">                         'name' => __( 'Forums', 'buddypress' )
</span></span></pre></div>
<a id="trunkbpcoreadminbpcoreupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/admin/bp-core-update.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/admin/bp-core-update.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-core/admin/bp-core-update.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -540,8 +540,8 @@
</span><span class="cx">                 $current_theme = wp_get_theme();
</span><span class="cx">                 $screenshot = '';
</span><span class="cx">
</span><del>-                if ( !empty( $installed_themes[$current_theme]['Screenshot'] ) ) {
-                        $screenshot = trailingslashit( get_stylesheet_directory_uri() ) . $installed_themes[$current_theme]['Screenshot'];
</del><ins>+                if ( !empty( $installed_themes[$current_theme->stylesheet]['Screenshot'] ) ) {
+                        $screenshot = trailingslashit( get_stylesheet_directory_uri() ) . $installed_themes[$current_theme->stylesheet]['Screenshot'];
</ins><span class="cx">                 } ?>
</span><span class="cx">
</span><span class="cx">                 <script type="text/javascript">
</span></span></pre></div>
<a id="trunkbpforumsbpforumsadminphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-admin.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-admin.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-forums/bp-forums-admin.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -1,133 +1,242 @@
</span><span class="cx"> <?php
</span><del>-
</del><span class="cx"> // Exit if accessed directly
</span><span class="cx"> if ( !defined( 'ABSPATH' ) ) exit;
</span><span class="cx">
</span><del>-/** UI ************************************************************************/
-
</del><span class="cx"> function bp_forums_add_admin_menu() {
</span><ins>+        global $bp;
</ins><span class="cx">
</span><del>-        if ( ! bp_current_user_can( 'bp_moderate' ) )
-                return;
</del><ins>+        if ( !is_super_admin() )
+                return false;
</ins><span class="cx">
</span><del>-        if ( ! bp_forums_is_repair() )
-                return;
</del><ins>+        $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
</ins><span class="cx">
</span><del>-        // Add the option pages
-        $page = bp_core_do_network_admin() ? 'settings.php' : 'options-general.php';
-        $hook = add_submenu_page( $page, __( 'BuddyPress Forums', 'buddypress' ), __( 'BuddyPress Forums', 'buddypress' ), 'manage_options', 'bb-forums-setup', 'bp_forums_bbpress_admin' );
</del><ins>+        // Add the administration tab under the "Site Admin" tab for site administrators
+        $hook = add_submenu_page( $page, __( 'Forums', 'buddypress' ), __( 'Forums', 'buddypress' ), 'manage_options', 'bb-forums-setup', "bp_forums_bbpress_admin" );
</ins><span class="cx">
</span><del>-        // Fudge the highlighted subnav item when on a BuddyPress admin page
</del><ins>+        // Fudge the highlighted subnav item when on the BuddyPress Forums admin page
</ins><span class="cx">         add_action( "admin_head-$hook", 'bp_core_modify_admin_menu_highlight' );
</span><span class="cx"> }
</span><span class="cx"> add_action( bp_core_admin_hook(), 'bp_forums_add_admin_menu' );
</span><span class="cx">
</span><span class="cx"> function bp_forums_bbpress_admin() {
</span><del>-?>
</del><ins>+        global $bp;
</ins><span class="cx">
</span><ins>+        $action = bp_get_admin_url( 'admin.php?page=bb-forums-setup&reinstall=1' ); ?>
+
</ins><span class="cx">         <div class="wrap">
</span><del>-
</del><span class="cx">                 <?php screen_icon( 'buddypress' ); ?>
</span><span class="cx">
</span><span class="cx">                 <h2 class="nav-tab-wrapper"><?php bp_core_admin_tabs( __( 'Forums', 'buddypress' ) ); ?></h2>
</span><span class="cx">
</span><del>-                <h3><?php _e( 'Forum Repair', 'buddypress' ); ?></h3>
</del><ins>+                <?php if ( isset( $_POST['submit'] ) ) : ?>
</ins><span class="cx">
</span><del>-                <?php if ( bp_forums_is_repair() ) : ?>
</del><ins>+                        <div id="message" class="updated fade">
+                                <p><?php _e( 'Settings Saved.', 'buddypress' ) ?></p>
+                        </div>
</ins><span class="cx">
</span><del>-                        <p><?php printf( __( 'The following configuration was successfully saved to: %s', 'buddypress' ), bp_get_option( 'bb-config-location' ) );?></p>
</del><ins>+                <?php endif; ?>
</ins><span class="cx">
</span><del>-                        <div id="template">
-                                <textarea cols="70" rows="25" name="bb-config" id="bb-config"><?php echo bp_forums_bbpress_install( bp_get_option( 'bb-config-location' ) ); ?></textarea>
-                        </div>
</del><ins>+                <?php
</ins><span class="cx">
</span><del>-                <?php elseif ( bp_forums_is_migrate() ) : ?>
</del><ins>+                if ( isset( $_REQUEST['reinstall'] ) || !bp_forums_is_installed_correctly() ) :
</ins><span class="cx">
</span><del>-                        <?php
-                                add_thickbox();
-                                wp_enqueue_script( 'plugin-install' );
-                                wp_admin_css( 'plugin-install' );
-                        ?>
</del><ins>+                        // Delete the bb-config.php location option
+                        bp_delete_option( 'bb-config-location' );
+                        bp_forums_bbpress_install_wizard();
</ins><span class="cx">
</span><del>-                        <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
</del><ins>+                else : ?>
</ins><span class="cx">
</span><del>-                <?php else : ?>
</del><ins>+                        <div style="width: 45%; float: left; margin-top: 20px;">
+                                <h3><?php _e( '(Installed)', 'buddypress' ); ?> <?php _e( 'Forums for Groups', 'buddypress' ) ?></h3>
</ins><span class="cx">
</span><ins>+                                <p><?php _e( 'Give each individual group its own discussion forum. Choose this if you\'d like to keep your members\' conversations separated into distinct areas.' , 'buddypress' ); ?></p>
+                                <p class="description"><?php _e( 'You may use an existing bbPress installation if you have one.', 'buddypress' ); ?></p>
+
+                                <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
+                                <ul class="description" style="list-style: square; margin-left: 30px;">
+                                        <li><?php _e( 'Group Integration', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( 'Member Profile Integration', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
+                                </ul>
+
+                                <div>
+                                        <a class="button button-primary" href="<?php echo $action ?>"><?php _e( 'Uninstall Group Forums', 'buddypress' ) ?></a> &nbsp;
+                                </div>
+                        </div>
+
+                        <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">
+                                <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3>
+                                <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p>
+                                <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p>
+
+                                <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
+                                <ul class="description" style="list-style: square; margin-left: 30px;">
+                                        <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
+                                        <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
+                                </ul>
+                                <div>
+                                        <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
+                                </div>
+                        </div>
+
</ins><span class="cx">                 <?php endif; ?>
</span><span class="cx">
</span><span class="cx">         </div>
</span><span class="cx"> <?php
</span><span class="cx"> }
</span><span class="cx">
</span><del>-/** _is_ **********************************************************************/
</del><ins>+function bp_forums_bbpress_install_wizard() {
+        $post_url = network_admin_url( 'admin.php?page=bb-forums-setup' );
</ins><span class="cx">
</span><del>-/**
- * Trying to repair a bbPress 1.x installation
- *
- * @since BuddyPress (1.6)
- * @return boolean True if option exists, false if not
- */
-function bp_forums_is_repair() {
</del><ins>+        $step = isset( $_REQUEST['step'] ) ? $_REQUEST['step'] : '';
</ins><span class="cx">
</span><del>-        // Bail if bbPress 1.x was never installed
-        if ( isset( $_REQUEST['repair'] ) && bp_forums_is_installed_correctly() )
-                return true;
</del><ins>+        switch( $step ) {
+                case 'existing':
+                        if ( isset( $_REQUEST['doinstall'] ) && ( 1 == (int) $_REQUEST['doinstall'] ) ) {
+                                if ( !bp_forums_configure_existing_install() ) {
+                                        _e( 'The bb-config.php file was not found at that location, please try again.', 'buddypress' );
+                                } else {
+                                        ?>
+                                        <h3><?php _e( 'Forums were set up correctly using your existing bbPress install!', 'buddypress' ) ?></h3>
+                                        <p><?php _e( 'BuddyPress will now use its internal copy of bbPress to run the forums on your site. If you wish, you can remove your old bbPress installation files, as long as you keep the bb-config.php file in the same location.', 'buddypress' ) ?></p><?php
+                                }
+                        } else { ?>
</ins><span class="cx">
</span><del>-        return false;
-}
</del><ins>+                                        <form action="" method="post">
+                                                <h3><?php _e( 'Existing bbPress Installation', 'buddypress' ) ?></h3>
+                                                <p><?php _e( "BuddyPress can make use of your existing bbPress install. Just provide the location of your <code>bb-config.php</code> file, and BuddyPress will do the rest.", 'buddypress' ) ?></p>
+                                                <p><label><code>bb-config.php</code> file location:</label><br /><input style="width: 50%" type="text" name="bbconfigloc" id="bbconfigloc" value="<?php echo str_replace( 'buddypress', '', $_SERVER['DOCUMENT_ROOT'] ) ?>" /></p>
+                                                <p><input type="submit" class="button-primary" value="<?php _e( 'Complete Installation', 'buddypress' ) ?>" /></p>
+                                                <input type="hidden" name="step" value="existing" />
+                                                <input type="hidden" name="doinstall" value="1" />
+                                                <?php wp_nonce_field( 'bp_forums_existing_install_init' ) ?>
+                                        </form>
</ins><span class="cx">
</span><del>-/**
- * bbPress 1.x is installed, and we're moving to bbPress 2.x
- *
- * @since BuddyPress (1.6)
- * @return boolean True if option exists, false if not
- */
-function bp_forums_is_migrate() {
</del><ins>+                                <?php
+                        }
+                break;
</ins><span class="cx">
</span><del>-        // Bail if bbPress 1.x was never installed
-        if ( isset( $_REQUEST['migrate'] ) && bp_forums_is_installed_correctly() )
-                return true;
</del><ins>+                case 'new':
+                        if ( isset( $_REQUEST['doinstall'] ) && 1 == (int)$_REQUEST['doinstall'] ) {
+                                $result = bp_forums_bbpress_install();
</ins><span class="cx">
</span><del>-        return false;
-}
</del><ins>+                                switch ( $result ) {
+                                        case 1:
+                                                _e( '<p>All done! Configuration settings have been saved to the file <code>bb-config.php</code> in the root of your WordPress install.</p>', 'buddypress' );
+                                                break;
+                                        default:
+                                                // Just write the contents to screen
+                                                _e( '<p>A configuration file could not be created. No problem, but you will need to save the text shown below into a file named <code>bb-config.php</code> in the root directory of your WordPress installation before you can start using the forum functionality.</p>', 'buddypress' ); ?>
</ins><span class="cx">
</span><del>-/**
- * bbPress was never installed before, and bbPress 2.x is not installed yet
- *
- * @since BuddyPress (1.6)
- * @return boolean True if option exists, false if not
- */
-function bp_forums_is_fresh_install() {
</del><ins>+                                                <textarea style="display:block; margin-top: 30px; width: 80%;" rows="50"><?php echo htmlspecialchars( $result ); ?></textarea>
</ins><span class="cx">
</span><del>-        // Bail if bbPress 1.x was never installed
-        if ( isset( $_REQUEST['install'] ) && ! bp_forums_is_installed_correctly() )
-                return true;
</del><ins>+                                        <?php
+                                                break;
+                                }
+                        } else { ?>
</ins><span class="cx">
</span><del>-        return false;
</del><ins>+                                <h3><?php _e( 'New bbPress Installation', 'buddypress' ) ?></h3>
+                                <p><?php _e( "You've decided to set up a new installation of bbPress for forum management in BuddyPress. This is very simple and is usually just a one click
+                                process. When you're ready, hit the link below.", 'buddypress' ) ?></p>
+                                <p><a class="button-primary" href="<?php echo wp_nonce_url( $post_url . '&step=new&doinstall=1', 'bp_forums_new_install_init' ) ?>"><?php _e( 'Complete Installation', 'buddypress' ) ?></a></p>
+
+                                <?php
+                        }
+                break;
+
+                default:
+                        if ( !file_exists( BP_PLUGIN_DIR . '/bp-forums/bbpress/' ) ) { ?>
+
+                                <div id="message" class="error">
+                                        <p><?php printf( __( 'bbPress files were not found. To install the forums component you must download a copy of bbPress and make sure it is in the folder: "%s"', 'buddypress' ), 'wp-content/plugins/buddypress/bp-forums/bbpress/' ) ?></p>
+                                </div>
+
+                        <?php } else {
+
+                                // Include the plugin install
+
+                                add_thickbox();
+                                wp_enqueue_script( 'plugin-install' );
+                                wp_admin_css( 'plugin-install' );
+                        ?>
+
+                                <div style="width: 45%; float: left; margin-top: 20px;">
+                                        <h3><?php _e( 'Forums for Groups', 'buddypress' ) ?></h3>
+
+                                        <p><?php _e( 'Give each individual group its own discussion forum. Choose this if you\'d like to keep your members\' conversations separated into distinct areas.' , 'buddypress' ); ?></p>
+                                        <p class="description"><?php _e( 'You may use an existing bbPress installation if you have one.', 'buddypress' ); ?></p>
+
+                                        <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
+                                        <ul class="description" style="list-style: square; margin-left: 30px;">
+                                                <li><?php _e( 'Group Integration', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( 'Member Profile Integration', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
+                                        </ul>
+
+                                        <div>
+                                                <a class="button button-primary" href="<?php echo $post_url . '&step=new' ?>"><?php _e( 'Install Group Forums', 'buddypress' ) ?></a> &nbsp;
+                                                <a class="button" href="<?php echo $post_url . '&step=existing' ?>"><?php _e( 'Use Existing Installation', 'buddypress' ) ?></a>
+                                        </div>
+                                </div>
+
+                                <div style="width: 45%; float: left; margin: 20px 0 20px 20px; padding: 0 20px 20px 20px; border: 1px solid #ddd; background-color: #fff;">
+                                        <h3><?php _e( 'New! Site Wide Forums', 'buddypress' ) ?></h3>
+                                        <p><?php _e( 'Your site will have central forums that are not isolated to any specific group. Choose this if you\'d like to have a central forum area for your members.', 'buddypress' ) ?></p>
+                                        <p class="description"><?php _e( 'You may activate both Group and Site Wide forums, but this may create a poor experience for your members.', 'buddypress' ) ?></p>
+
+                                        <h4 style="margin-bottom: 10px;"><?php _e( 'Features', 'buddypress' ); ?></h4>
+                                        <ul class="description" style="list-style: square; margin-left: 30px;">
+                                                <li><?php _e( 'Central Discussion Area', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( 'Forum Plugins Available', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( 'Activity Stream Integration', 'buddypress' ); ?></p></li>
+                                                <li><?php _e( '@ Mention Integration', 'buddypress' ); ?></p></li>
+                                        </ul>
+                                        <div>
+                                                <a class="button thickbox button-primary" href="<?php bp_admin_url( add_query_arg( array( 'tab' => 'plugin-information', 'plugin' => 'bbpress', 'TB_iframe' => 'true', 'width' => '640', 'height' => '500' ), 'plugin-install.php' ) ); ?>"><?php _e( 'Install Site Wide Forums', 'buddypress' ) ?></a> &nbsp;
+                                        </div>
+                                </div>
+
+                        <?php }
+                break;
+        }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-/**
- * Both bbPress 1.x and bbPress 2.x are installed
- *
- * @since BuddyPress (1.6)
- * @return boolean True if option exists, false if not
- */
-function bp_forums_is_hybrid_install() {
</del><ins>+function bp_forums_configure_existing_install() {
+        global $wpdb, $bbdb;
</ins><span class="cx">
</span><del>-        // Bail if bbPress 1.x was never installed
-        if ( isset( $_REQUEST['install'] ) && bp_forums_is_bbpress_active && bp_forums_is_installed_correctly() )
-                return true;
</del><ins>+        check_admin_referer( 'bp_forums_existing_install_init' );
</ins><span class="cx">
</span><del>-        return false;
</del><ins>+        // Sanitize $_REQUEST['bbconfigloc']
+        $_REQUEST['bbconfigloc'] = apply_filters( 'bp_forums_bbconfig_location', $_REQUEST['bbconfigloc'] );
+
+        if ( false === strpos( $_REQUEST['bbconfigloc'], 'bb-config.php' ) ) {
+                if ( '/' != substr( $_REQUEST['bbconfigloc'], -1, 1 ) )
+                        $_REQUEST['bbconfigloc'] .= '/';
+
+                $_REQUEST['bbconfigloc'] .= 'bb-config.php';
+        }
+
+        bp_update_option( 'bb-config-location', $_REQUEST['bbconfigloc'] );
+
+        if ( !file_exists( $_REQUEST['bbconfigloc'] ) ) {
+                return false;
+        }
+
+        return true;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-/** Config ********************************************************************/
-
</del><span class="cx"> function bp_forums_bbpress_install( $location = '' ) {
</span><del>-        global $wpdb, $bp;
</del><ins>+        global $wpdb, $bbdb, $bp;
</ins><span class="cx">
</span><del>-        if ( empty( $location ) )
</del><ins>+        check_admin_referer( 'bp_forums_new_install_init' );
+
+        if ( empty( $location ) ) {
</ins><span class="cx">                 $location = ABSPATH . 'bb-config.php';
</span><ins>+        }
</ins><span class="cx">
</span><span class="cx">         // Create the bb-config.php file
</span><span class="cx">         $initial_write = bp_forums_bbpress_write(
</span><span class="lines">@@ -163,7 +272,7 @@
</span><span class="cx">
</span><span class="cx">         $file .= "\n" . '$bb->custom_user_table = \'' . $wpdb->users . '\';';
</span><span class="cx">         $file .= "\n" . '$bb->custom_user_meta_table = \'' . $wpdb->usermeta . '\';';
</span><del>-        $file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . 'bp-forums/bbpress/\';';
</del><ins>+        $file .= "\n\n" . '$bb->uri = \'' . BP_PLUGIN_URL . '/bp-forums/bbpress/\';';
</ins><span class="cx">         $file .= "\n" . '$bb->name = \'' . get_blog_option( bp_get_root_blog_id(), 'blogname' ) . ' ' . __( 'Forums', 'buddypress' ) . '\';';
</span><span class="cx">
</span><span class="cx">         if ( is_multisite() ) {
</span><span class="lines">@@ -194,8 +303,7 @@
</span><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         bp_update_option( 'bb-config-location', $location );
</span><del>-
-        return $file;
</del><ins>+        return $initial_write;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> function bp_forums_bbpress_write( $file_source, $file_target, $alterations ) {
</span><span class="lines">@@ -254,9 +362,10 @@
</span><span class="cx">
</span><span class="cx">         // Write lines one by one to avoid OS specific newline hassles
</span><span class="cx">         foreach ( (array) $modified_lines as $modified_line ) {
</span><del>-                if ( false !== strpos( $modified_line, '?>' ) ) {
</del><ins>+                if ( strlen( $modified_line ) - 2 === strrpos( $modified_line, '?>' ) ) {
</ins><span class="cx">                         $modified_line = '?>';
</span><span class="cx">                 }
</span><ins>+
</ins><span class="cx">                 fwrite( $file_handle, $modified_line );
</span><span class="cx">                 if ( $modified_line == '?>' ) {
</span><span class="cx">                         break;
</span></span></pre></div>
<a id="trunkbpforumsbpforumsfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-functions.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-functions.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-forums/bp-forums-functions.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -34,7 +34,9 @@
</span><span class="cx"> * @return boolean True if option exists, false if not
</span><span class="cx"> */
</span><span class="cx"> function bp_forums_is_installed_correctly() {
</span><del>-        if ( bp_get_option(        'bb-config-location' ) )
</del><ins>+        global $bp;
+
+        if ( isset( $bp->forums->bbconfig ) && is_file( $bp->forums->bbconfig ) )
</ins><span class="cx">                 return true;
</span><span class="cx">
</span><span class="cx">         return false;
</span></span></pre></div>
<a id="trunkbpforumsbpforumsloaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-loader.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-loader.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-forums/bp-forums-loader.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -47,6 +47,10 @@
</span><span class="cx">                 if ( !defined( 'BP_FORUMS_SLUG' ) )
</span><span class="cx">                         define( 'BP_FORUMS_SLUG', $this->id );
</span><span class="cx">
</span><ins>+                // The location of the bbPress stand-alone config file
+                if ( isset( $bp->site_options['bb-config-location'] ) )
+                        $this->bbconfig = $bp->site_options['bb-config-location'];
+
</ins><span class="cx">                 // All globals for messaging component.
</span><span class="cx">                 // Note that global_tables is included in this array.
</span><span class="cx">                 $globals = array(
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultgroupscreatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/groups/create.php (6107 => 6108)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/groups/create.php        2012-06-18 12:43:03 UTC (rev 6107)
+++ trunk/bp-themes/bp-default/groups/create.php        2012-06-18 13:06:13 UTC (rev 6108)
</span><span class="lines">@@ -107,16 +107,23 @@
</span><span class="cx">                                                 </label>
</span><span class="cx">                                         </div>
</span><span class="cx">
</span><del>-                                        <?php if ( bp_is_active( 'forums' ) && bp_forums_is_installed_correctly() ) : ?>
</del><ins>+                                        <?php if ( bp_is_active( 'forums' ) ) : ?>
</ins><span class="cx">
</span><span class="cx">                                                 <h4><?php _e( 'Group Forums', 'buddypress' ); ?></h4>
</span><span class="cx">
</span><del>-                                                <p><?php _e( 'Should this group have a forum?', 'buddypress' ); ?></p>
</del><ins>+                                                <?php if ( bp_forums_is_installed_correctly() ) : ?>
</ins><span class="cx">
</span><del>-                                                <div class="checkbox">
-                                                        <label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php checked( bp_get_new_group_enable_forum(), true, true ); ?> /> <?php _e( 'Enable discussion forum', 'buddypress' ); ?></label>
-                                                </div>
</del><ins>+                                                        <p><?php _e( 'Should this group have a forum?', 'buddypress' ); ?></p>
</ins><span class="cx">
</span><ins>+                                                        <div class="checkbox">
+                                                                <label><input type="checkbox" name="group-show-forum" id="group-show-forum" value="1"<?php checked( bp_get_new_group_enable_forum(), true, true ); ?> /> <?php _e( 'Enable discussion forum', 'buddypress' ); ?></label>
+                                                        </div>
+                                                <?php elseif ( is_super_admin() ) : ?>
+
+                                                        <p><?php printf( __( '<strong>Attention Site Admin:</strong> Group forums require the <a href="%s">correct setup and configuration</a> of a bbPress installation.', 'buddypress' ), bp_core_do_network_admin() ? network_admin_url( 'settings.php?page=bb-forums-setup' ) : admin_url( 'admin.php?page=bb-forums-setup' ) ); ?></p>
+
+                                                <?php endif; ?>
+
</ins><span class="cx">                                         <?php endif; ?>
</span><span class="cx">
</span><span class="cx">                                         <?php do_action( 'bp_after_group_settings_creation_step' ); ?>
</span></span></pre>
</div>
</div>
</body>
</html>