<!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][6436] trunk: Theme Compat:</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/6436">6436</a></dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2012-10-22 05:24:36 +0000 (Mon, 22 Oct 2012)</dd>
</dl>

<h3>Log Message</h3>
<pre>Theme Compat:

* Put back 'bp_register_theme_directory' sub action, hooked to 'bp_loaded'
* Move register_theme_directory() back into !BuddyPress root class method.
* Introduces old_themes_dir variable, which will get deprecated when we remove bp-default from core.
* Create 'bp-templates' root folder, for theme-compat templates to live in, and not conflict with 'bp-themes'.
* Fixes issue where 'bp-legacy' would show up as &quot;Broken&quot; in Appearance &gt; Themes.
* Brute-force switch from bp-default to WP_DEFAULT_THEME on deactivation, and update theme roots, to fix issue when deactivating !BuddyPress while theme stack relies on bp-default.
* See <a href="http://buddypress.trac.wordpress.org/ticket/3741">#3741</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoreactionsphp">trunk/bp-core/bp-core-actions.php</a></li>
<li><a href="#trunkbpcorebpcoredependencyphp">trunk/bp-core/bp-core-dependency.php</a></li>
<li><a href="#trunkbpcorebpcoreupdatephp">trunk/bp-core/bp-core-update.php</a></li>
<li><a href="#trunkbploaderphp">trunk/bp-loader.php</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li>trunk/bp-templates/</li>
<li>trunk/bp-templates/bp-legacy/</li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li>trunk/bp-themes/bp-legacy/</li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoreactionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-actions.php (6435 => 6436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-actions.php        2012-10-20 20:36:34 UTC (rev 6435)
+++ trunk/bp-core/bp-core-actions.php        2012-10-22 05:24:36 UTC (rev 6436)
</span><span class="lines">@@ -48,13 +48,14 @@
</span><span class="cx">  *
</span><span class="cx">  * Attach various loader actions to the bp_loaded action.
</span><span class="cx">  * The load order helps to execute code at the correct time.
</span><del>- *                                                     v---Load order
</del><ins>+ *                                                      v---Load order
</ins><span class="cx">  */
</span><del>-add_action( 'bp_loaded', 'bp_setup_components',        2  );
-add_action( 'bp_loaded', 'bp_include',                 4  );
-add_action( 'bp_loaded', 'bp_setup_widgets',           6  );
-add_action( 'bp_loaded', 'bp_core_load_admin_bar',     10 );
-add_action( 'bp_loaded', 'bp_register_theme_packages', 16 );
</del><ins>+add_action( 'bp_loaded', 'bp_setup_components',         2  );
+add_action( 'bp_loaded', 'bp_include',                  4  );
+add_action( 'bp_loaded', 'bp_setup_widgets',            6  );
+add_action( 'bp_loaded', 'bp_core_load_admin_bar',      10 );
+add_action( 'bp_loaded', 'bp_register_theme_packages',  12 );
+add_action( 'bp_loaded', 'bp_register_theme_directory', 14 );
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><span class="cx">  * bp_init - Attached to 'init' above
</span></span></pre></div>
<a id="trunkbpcorebpcoredependencyphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-dependency.php (6435 => 6436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-dependency.php        2012-10-20 20:36:34 UTC (rev 6435)
+++ trunk/bp-core/bp-core-dependency.php        2012-10-22 05:24:36 UTC (rev 6436)
</span><span class="lines">@@ -126,6 +126,16 @@
</span><span class="cx"> /** Theme Helpers *************************************************************/
</span><span class="cx"> 
</span><span class="cx"> /**
</span><ins>+ * The main action used registering theme directory
+ *
+ * @since BuddyPress (1.5)
+ * @uses do_action()
+ */
+function bp_register_theme_directory() {
+        do_action( 'bp_register_theme_directory' );
+}
+
+/**
</ins><span class="cx">  * The main action used registering theme packages
</span><span class="cx">  *
</span><span class="cx">  * @since BuddyPress (1.7)
</span></span></pre></div>
<a id="trunkbpcorebpcoreupdatephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-update.php (6435 => 6436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-update.php        2012-10-20 20:36:34 UTC (rev 6435)
+++ trunk/bp-core/bp-core-update.php        2012-10-22 05:24:36 UTC (rev 6436)
</span><span class="lines">@@ -180,6 +180,14 @@
</span><span class="cx">         // Force refresh theme roots.
</span><span class="cx">         delete_site_transient( 'theme_roots' );
</span><span class="cx"> 
</span><ins>+        // Switch to WordPress's default theme if current parent or child theme
+        // depend on bp-default. This is to prevent white screens of doom.
+        if ( in_array( 'bp-default', array( get_template(), get_stylesheet() ) ) ) {
+                switch_theme( WP_DEFAULT_THEME, WP_DEFAULT_THEME );
+                update_option( 'template_root',   get_raw_theme_root( WP_DEFAULT_THEME, true ) );
+                update_option( 'stylesheet_root', get_raw_theme_root( WP_DEFAULT_THEME, true ) );
+        }
+
</ins><span class="cx">         // Use as of (1.6)
</span><span class="cx">         do_action( 'bp_deactivation' );
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbploaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-loader.php (6435 => 6436)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-loader.php        2012-10-20 20:36:34 UTC (rev 6435)
+++ trunk/bp-loader.php        2012-10-22 05:24:36 UTC (rev 6436)
</span><span class="lines">@@ -331,18 +331,22 @@
</span><span class="cx">                 /** Paths *************************************************************/
</span><span class="cx"> 
</span><span class="cx">                 // BuddyPress root directory
</span><del>-                $this-&gt;file       = __FILE__;
-                $this-&gt;basename   = plugin_basename( $this-&gt;file );
-                $this-&gt;plugin_dir = BP_PLUGIN_DIR;
-                $this-&gt;plugin_url = BP_PLUGIN_URL;
</del><ins>+                $this-&gt;file           = __FILE__;
+                $this-&gt;basename       = plugin_basename( $this-&gt;file );
+                $this-&gt;plugin_dir     = BP_PLUGIN_DIR;
+                $this-&gt;plugin_url     = BP_PLUGIN_URL;
</ins><span class="cx"> 
</span><del>-                // Themes
-                $this-&gt;themes_dir = $this-&gt;plugin_dir . 'bp-themes';
-                $this-&gt;themes_url = $this-&gt;plugin_url . 'bp-themes';
-
</del><span class="cx">                 // Languages
</span><del>-                $this-&gt;lang_dir   = $this-&gt;plugin_dir . 'bp-languages';
</del><ins>+                $this-&gt;lang_dir       = $this-&gt;plugin_dir . 'bp-languages';
</ins><span class="cx"> 
</span><ins>+                // Templates (theme compatability)
+                $this-&gt;themes_dir     = $this-&gt;plugin_dir . 'bp-templates';
+                $this-&gt;themes_url     = $this-&gt;plugin_url . 'bp-templates';
+
+                // Themes (for bp-default)
+                $this-&gt;old_themes_dir = $this-&gt;plugin_dir . 'bp-themes';
+                $this-&gt;old_themes_url = $this-&gt;plugin_url . 'bp-themes';
+
</ins><span class="cx">                 /** Theme Compat ******************************************************/
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;theme_compat   = new stdClass(); // Base theme compatibility class
</span><span class="lines">@@ -350,8 +354,8 @@
</span><span class="cx"> 
</span><span class="cx">                 /** Users *************************************************************/
</span><span class="cx"> 
</span><del>-                $this-&gt;current_user       = new stdClass();
-                $this-&gt;displayed_user     = new stdClass();
</del><ins>+                $this-&gt;current_user   = new stdClass();
+                $this-&gt;displayed_user = new stdClass();
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /**
</span><span class="lines">@@ -497,14 +501,23 @@
</span><span class="cx">                 foreach( $actions as $class_action )
</span><span class="cx">                         add_action( 'bp_' . $class_action, array( $this, $class_action ), 5 );
</span><span class="cx"> 
</span><del>-                // Setup the BuddyPress theme directory
-                // @todo Move bp-default to wordpress.org/extend/themes and remove this
-                register_theme_directory( $this-&gt;themes_dir );
</del><ins>+                // All BuddyPress actions are setup (includes bbp-core-hooks.php)
+                do_action_ref_array( 'bp_after_setup_actions', array( &amp;$this ) );
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         /** Public Methods ********************************************************/
</span><span class="cx"> 
</span><span class="cx">         /**
</span><ins>+         * Setup the BuddyPress theme directory
+         *
+         * @since BuddyPress (1.5)
+         * @todo Move bp-default to wordpress.org/extend/themes and remove this
+         */
+        public function register_theme_directory() {
+                register_theme_directory( $this-&gt;old_themes_dir );
+        }
+
+        /**
</ins><span class="cx">          * Register bundled theme packages
</span><span class="cx">          *
</span><span class="cx">          * Note that since we currently have complete control over bp-themes and
</span></span></pre>
</div>
</div>

</body>
</html>