<!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] [1816] trunk:
Adding bp_get_body_class as a filter on body_class so WordPress and BuddyPress body classes can be used and output at the same time
.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>1816</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2009-09-07 21:00:29 +0000 (Mon, 07 Sep 2009)</dd>
</dl>
<h3>Log Message</h3>
<pre>Adding bp_get_body_class as a filter on body_class so WordPress and BuddyPress body classes can be used and output at the same time. Fixes #955</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpthemesbpsnframeworkheaderphp">trunk/bp-themes/bp-sn-framework/header.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 (1815 => 1816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2009-09-07 20:42:59 UTC (rev 1815)
+++ trunk/bp-core/bp-core-templatetags.php        2009-09-07 21:00:29 UTC (rev 1816)
</span><span class="lines">@@ -1583,143 +1583,142 @@
</span><span class="cx"> function bp_the_body_class() {
</span><span class="cx">         echo bp_get_the_body_class();
</span><span class="cx"> }
</span><del>-add_action( 'bp_body_class', 'bp_the_body_class' );
-
-        function bp_get_the_body_class() {
</del><ins>+        function bp_get_the_body_class( $wp_classes ) {
</ins><span class="cx">                 if ( bp_is_blog_page() || bp_is_activation_page() || bp_is_register_page() )
</span><del>-                        $class[] = 'blog-page';
</del><ins>+                        $bp_classes[] = 'blog-page';
</ins><span class="cx">                         
</span><span class="cx">                 if ( !bp_is_blog_page() && !is_home() && !bp_is_register_page() && !bp_is_activation_page() )
</span><del>-                        $class[] = 'internal-page';
</del><ins>+                        $bp_classes[] = 'internal-page';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_blog_page() && is_home() )
</span><del>-                        $class[] = 'home-page';
</del><ins>+                        $bp_classes[] = 'home-page';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_directory() )
</span><del>-                        $class[] = 'directory';
</del><ins>+                        $bp_classes[] = 'directory';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_profile() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'profile';
</del><ins>+                        $bp_classes[] = 'profile';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_activity() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'activity';                
</del><ins>+                        $bp_classes[] = 'activity';                
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_blogs() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'blogs';
</del><ins>+                        $bp_classes[] = 'blogs';
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_wire() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'wire';
</del><ins>+                        $bp_classes[] = 'wire';
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_messages() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'messages';                                        
</del><ins>+                        $bp_classes[] = 'messages';                                        
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_friends() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'friends';
</del><ins>+                        $bp_classes[] = 'friends';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_groups() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'groups';
</del><ins>+                        $bp_classes[] = 'groups';
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_settings() && !bp_is_blog_page() )
</span><del>-                        $class[] = 'settings';
</del><ins>+                        $bp_classes[] = 'settings';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_site_item() )
</span><del>-                        $class[] = 'single-item';
</del><ins>+                        $bp_classes[] = 'single-item';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_inbox() )
</span><del>-                        $class[] = 'inbox';
</del><ins>+                        $bp_classes[] = 'inbox';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_friend_requests() )
</span><del>-                        $class[] = 'friend-requests';
</del><ins>+                        $bp_classes[] = 'friend-requests';
</ins><span class="cx">
</span><span class="cx">                 if ( bp_is_friends_screen() )
</span><del>-                        $class[] = 'my-friends';
</del><ins>+                        $bp_classes[] = 'my-friends';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_create_blog() )
</span><del>-                        $class[] = 'create-blog';
</del><ins>+                        $bp_classes[] = 'create-blog';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_recent_commments() )
</span><del>-                        $class[] = 'recent-comments';
</del><ins>+                        $bp_classes[] = 'recent-comments';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_recent_posts() )
</span><del>-                        $class[] = 'recent-posts';
</del><ins>+                        $bp_classes[] = 'recent-posts';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_my_blogs() && !bp_is_directory() )
</span><del>-                        $class[] = 'my-blogs';
</del><ins>+                        $bp_classes[] = 'my-blogs';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_my_groups() && !bp_is_directory() )
</span><del>-                        $class[] = 'my-groups';
</del><ins>+                        $bp_classes[] = 'my-groups';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_leave() )
</span><del>-                        $class[] = 'leave-group';
</del><ins>+                        $bp_classes[] = 'leave-group';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_invites() )
</span><del>-                        $class[] = 'group-invites';
</del><ins>+                        $bp_classes[] = 'group-invites';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_members() )
</span><del>-                        $class[] = 'group-members';
</del><ins>+                        $bp_classes[] = 'group-members';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_forum_topic() )
</span><del>-                        $class[] = 'group-forum-topic';
</del><ins>+                        $bp_classes[] = 'group-forum-topic';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_forum() )
</span><del>-                        $class[] = 'group-forum';
</del><ins>+                        $bp_classes[] = 'group-forum';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_wire() )
</span><del>-                        $class[] = 'group-wire';
</del><ins>+                        $bp_classes[] = 'group-wire';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_group_admin_page() )
</span><del>-                        $class[] = 'group-admin';
</del><ins>+                        $bp_classes[] = 'group-admin';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_group_create() )
</span><del>-                        $class[] = 'group-create';
</del><ins>+                        $bp_classes[] = 'group-create';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_group_home() )
</span><del>-                        $class[] = 'group-home';
</del><ins>+                        $bp_classes[] = 'group-home';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_profile_wire() )
</span><del>-                        $class[] = 'profile-wire';
</del><ins>+                        $bp_classes[] = 'profile-wire';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_change_avatar() )
</span><del>-                        $class[] = 'change-avatar';
</del><ins>+                        $bp_classes[] = 'change-avatar';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_profile_edit() )
</span><del>-                        $class[] = 'profile-edit';
</del><ins>+                        $bp_classes[] = 'profile-edit';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_friends_activity() )
</span><del>-                        $class[] = 'friends-activity';
</del><ins>+                        $bp_classes[] = 'friends-activity';
</ins><span class="cx">                         
</span><span class="cx">                 if ( bp_is_my_activity() )
</span><del>-                        $class[] = 'my-activity';
</del><ins>+                        $bp_classes[] = 'my-activity';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_register_page() )
</span><del>-                        $class[] = 'registration';
</del><ins>+                        $bp_classes[] = 'registration';
</ins><span class="cx">                 
</span><span class="cx">                 if ( bp_is_activation_page() )
</span><del>-                        $class[] = 'activation';
</del><ins>+                        $bp_classes[] = 'activation';
</ins><span class="cx">                         
</span><span class="cx">                 if ( is_single() )
</span><del>-                        $class[] = 'blog-single';
</del><ins>+                        $bp_classes[] = 'blog-single';
</ins><span class="cx">
</span><span class="cx">                 if ( is_category() )
</span><del>-                        $class[] = 'blog-category';
</del><ins>+                        $bp_classes[] = 'blog-category';
</ins><span class="cx">
</span><span class="cx">                 if ( is_tag() )
</span><del>-                        $class[] = 'blog-tag';
</del><ins>+                        $bp_classes[] = 'blog-tag';
</ins><span class="cx">                         
</span><span class="cx">                 if ( is_search() )
</span><del>-                        $class[] = 'blog-search';
</del><ins>+                        $bp_classes[] = 'blog-search';
</ins><span class="cx">
</span><span class="cx">                 if ( is_day() )
</span><del>-                        $class[] = 'blog-day';
</del><ins>+                        $bp_classes[] = 'blog-day';
</ins><span class="cx">
</span><span class="cx">                 if ( is_month() )
</span><del>-                        $class[] = 'blog-month';
</del><ins>+                        $bp_classes[] = 'blog-month';
</ins><span class="cx">
</span><span class="cx">                 if ( is_year() )                
</span><del>-                        $class[] = 'blog-year';
</del><ins>+                        $bp_classes[] = 'blog-year';
</ins><span class="cx">                 
</span><del>-                return implode( ' ', $class );
</del><ins>+                return apply_filters( 'bp_get_the_body_class', array_merge( (array) $bp_classes, (array) $wp_classes ), $bp_classes, $wp_classes );
</ins><span class="cx">         }
</span><ins>+        add_filter( 'body_class', 'bp_get_the_body_class' )
</ins><span class="cx">
</span><span class="cx">
</span><span class="cx"> ?>
</span><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkbpthemesbpsnframeworkheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-sn-framework/header.php (1815 => 1816)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-sn-framework/header.php        2009-09-07 20:42:59 UTC (rev 1815)
+++ trunk/bp-themes/bp-sn-framework/header.php        2009-09-07 21:00:29 UTC (rev 1816)
</span><span class="lines">@@ -27,7 +27,7 @@
</span><span class="cx">
</span><span class="cx">         </head>
</span><span class="cx">
</span><del>-        <body class="<?php do_action( 'bp_body_class' ) ?>">
</del><ins>+        <body <?php body_class() ?>>
</ins><span class="cx">                 
</span><span class="cx">                 <div id="search-login-bar">
</span><span class="cx">         
</span></span></pre>
</div>
</div>
</body>
</html>