<!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] [1759] trunk: Fixed subnav access issues.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>1759</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-02 17:32:54 +0000 (Wed, 02 Sep 2009)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixed subnav access issues.</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkbpforumsbbconfigphp">trunk/bp-forums/bb-config.php</a></li>
<li><a href="#trunkbpforumsbpforumsfiltersphp">trunk/bp-forums/bp-forums-filters.php</a></li>
<li><a href="#trunkbpthemesdeprecatedbpmemberuserbarphp">trunk/bp-themes/deprecated/bpmember/userbar.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-core/bp-core-templatetags.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -118,20 +118,18 @@
</span><span class="cx">         
</span><span class="cx">                 /* Loop through each navigation item */
</span><span class="cx">                 foreach ( $bp-&gt;bp_options_nav[$bp-&gt;current_component] as $subnav_item ) {
</span><del>-                        $title = $subnav_item['name'];
-                        $slug = $subnav_item['slug'];
-                        $link = $subnav_item['link'];
-                        $css_id = $subnav_item['css_id'];
</del><ins>+                        if ( !$subnav_item['user_has_access'] )
+                                continue;
</ins><span class="cx">                         
</span><span class="cx">                         /* If the current action or an action variable matches the nav item id, then add a highlight CSS class. */
</span><del>-                        if ( $slug == $bp-&gt;current_action ) {
</del><ins>+                        if ( $subnav_item['slug'] == $bp-&gt;current_action ) {
</ins><span class="cx">                                 $selected = ' class=&quot;current&quot;';
</span><span class="cx">                         } else {
</span><span class="cx">                                 $selected = '';
</span><span class="cx">                         }
</span><span class="cx">                         
</span><span class="cx">                         /* echo out the final list item */
</span><del>-                        echo '&lt;li' . $selected . '&gt;&lt;a id=&quot;' . $css_id . '&quot; href=&quot;' . $link . '&quot;&gt;' . $title . '&lt;/a&gt;&lt;/li&gt;';                
</del><ins>+                        echo '&lt;li' . $selected . '&gt;&lt;a id=&quot;' . $subnav_item['css_id'] . '&quot; href=&quot;' . $subnav_item['link'] . '&quot;&gt;' . $subnav_item['name'] . '&lt;/a&gt;&lt;/li&gt;';                
</ins><span class="cx">                 }
</span><span class="cx">         } else {
</span><span class="cx">                 /* If we get here we are viewing another user, so show the displayed user's nav items */
</span></span></pre></div>
<a id="trunkbpcorephp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-core.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -276,7 +276,14 @@
</span><span class="cx">                 return false;
</span><span class="cx">                 
</span><span class="cx">         /* Add the administration tab under the &quot;Site Admin&quot; tab for site administrators */
</span><del>-        bp_core_add_admin_menu_page( array( 'menu_title' =&gt; __( 'BuddyPress', 'buddypress' ), 'page_title' =&gt; __( 'BuddyPress', 'buddypress' ), 'access_level' =&gt; 10, 'file' =&gt; 'bp-core.php', 'function' =&gt; 'bp_core_admin_settings', 'position' =&gt; 2 ) );
</del><ins>+        bp_core_add_admin_menu_page( array(
+                'menu_title' =&gt; __( 'BuddyPress', 'buddypress' ),
+                'page_title' =&gt; __( 'BuddyPress', 'buddypress' ),
+                'access_level' =&gt; 10, 'file' =&gt; 'bp-core.php',
+                'function' =&gt; 'bp_core_admin_settings',
+                'position' =&gt; 2
+        ) );
+        
</ins><span class="cx">         add_submenu_page( 'bp-core.php', __( 'General Settings', 'buddypress'), __( 'General Settings', 'buddypress' ), 1, 'bp-core.php', 'bp_core_admin_settings' );
</span><span class="cx">         add_submenu_page( 'bp-core.php', __( 'Component Setup', 'buddypress'), __( 'Component Setup', 'buddypress' ), 2, __FILE__, 'bp_core_admin_component_setup' );
</span><span class="cx"> }
</span><span class="lines">@@ -321,7 +328,14 @@
</span><span class="cx">                 $profile_link = $bp-&gt;loggedin_user-&gt;domain . '/profile/';
</span><span class="cx"> 
</span><span class="cx">                 /* Add the subnav items to the profile */
</span><del>-                bp_core_new_subnav_item( array( 'name' =&gt; __( 'Public', 'buddypress' ), 'slug' =&gt; 'public', 'parent_url' =&gt; $profile_link, 'parent_slug' =&gt; 'profile', 'screen_function' =&gt; 'xprofile_screen_display_profile', 'position' =&gt; 10 ) );
</del><ins>+                bp_core_new_subnav_item( array(
+                        'name' =&gt; __( 'Public', 'buddypress' ),
+                        'slug' =&gt; 'public',
+                        'parent_url' =&gt; $profile_link,
+                        'parent_slug' =&gt; 'profile',
+                        'screen_function' =&gt; 'xprofile_screen_display_profile',
+                        'position' =&gt; 10
+                ) );
</ins><span class="cx"> 
</span><span class="cx">                 if ( 'profile' == $bp-&gt;current_component ) {
</span><span class="cx">                         if ( bp_is_home() ) {
</span><span class="lines">@@ -571,10 +585,6 @@
</span><span class="cx">         if ( empty($name) || empty($slug) || empty($parent_slug) || empty($parent_url) || empty($screen_function) )
</span><span class="cx">                 return false;
</span><span class="cx">         
</span><del>-        /* If the logged in user does not have access */
-        if ( !$user_has_access )
-                return false;
-        
</del><span class="cx">         /* If this is for site admins only and the user is not one, don't create the subnav item */
</span><span class="cx">         if ( $site_admin_only &amp;&amp; !is_site_admin() )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -587,10 +597,11 @@
</span><span class="cx">                 'link' =&gt; $parent_url . $slug . '/',
</span><span class="cx">                 'slug' =&gt; $slug,
</span><span class="cx">                 'css_id' =&gt; $item_css_id,
</span><del>-                'position' =&gt; $position
</del><ins>+                'position' =&gt; $position,
+                'user_has_access' =&gt; $user_has_access
</ins><span class="cx">         );
</span><span class="cx">                 
</span><del>-        if ( $bp-&gt;current_action == $slug &amp;&amp; $bp-&gt;current_component == $parent_slug ) {
</del><ins>+        if ( ( $bp-&gt;current_action == $slug &amp;&amp; $bp-&gt;current_component == $parent_slug ) &amp;&amp; $user_has_access ) {
</ins><span class="cx">                 if ( !is_object($screen_function[0]) )
</span><span class="cx">                         add_action( 'wp', $screen_function, 3 );
</span><span class="cx">                 else
</span></span></pre></div>
<a id="trunkbpforumsbbconfigphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bb-config.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bb-config.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-forums/bb-config.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -1,5 +1,6 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> /***
</span><ins>+ * *** IMPORTANT ****
</ins><span class="cx">  * This file will stop people from accessing your bbPress installation directly.
</span><span class="cx">  * It is very important from a security standpoint that this file is not moved.
</span><span class="cx">  * Your actual bb-config.php file will be installed in the root of your WordPress
</span></span></pre></div>
<a id="trunkbpforumsbpforumsfiltersphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-filters.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-filters.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-forums/bp-forums-filters.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -1,6 +1,9 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> 
</span><span class="cx"> /* Apply WordPress defined filters */
</span><ins>+add_filter( 'bp_forums_bbconfig_location', 'wp_filter_kses', 1 );
+add_filter( 'bp_forums_bbconfig_location', 'attribute_escape', 1 );
+
</ins><span class="cx"> add_filter( 'bp_get_the_topic_title', 'wptexturize' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_poster_name', 'wptexturize' );
</span><span class="cx"> add_filter( 'bp_get_the_topic_last_poster_name', 'wptexturize' );
</span></span></pre></div>
<a id="trunkbpthemesdeprecatedbpmemberuserbarphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/deprecated/bpmember/userbar.php (1758 => 1759)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/deprecated/bpmember/userbar.php        2009-09-02 14:11:08 UTC (rev 1758)
+++ trunk/bp-themes/deprecated/bpmember/userbar.php        2009-09-02 17:32:54 UTC (rev 1759)
</span><span class="lines">@@ -23,7 +23,7 @@
</span><span class="cx">                 
</span><span class="cx">                 &lt;p id=&quot;login-text&quot;&gt;&lt;?php _e( 'You must log in to access your account.', 'buddypress' ) ?&gt;&lt;/p&gt;
</span><span class="cx">         
</span><del>-                &lt;form name=&quot;loginform&quot; id=&quot;loginform&quot; action=&quot;&lt;?php echo site_url('wp-login.php') ?&gt;&quot; method=&quot;post&quot;&gt;
</del><ins>+                &lt;form name=&quot;loginform&quot; id=&quot;loginform&quot; action=&quot;&lt;?php echo site_url( 'wp-login.php', 'login' ) ?&gt;&quot; method=&quot;post&quot;&gt;
</ins><span class="cx">                         &lt;p&gt;
</span><span class="cx">                                 &lt;label&gt;&lt;?php _e( 'Username', 'buddypress' ) ?&gt;&lt;br /&gt;
</span><span class="cx">                                 &lt;input type=&quot;text&quot; name=&quot;log&quot; id=&quot;user_login&quot; class=&quot;input&quot; value=&quot;&lt;?php echo attribute_escape(stripslashes($user_login)); ?&gt;&quot; /&gt;&lt;/label&gt;
</span></span></pre>
</div>
</div>

</body>
</html>