<!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] [3496] trunk/bp-themes/bp-default: Refactor functions.
 php to use appropriate theme-loading actions.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>3496</dd>
<dt>Author</dt> <dd>djpaul</dd>
<dt>Date</dt> <dd>2010-12-01 21:16:41 +0000 (Wed, 01 Dec 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Refactor functions.php to use appropriate theme-loading actions.
Improved support for custom thumbnails; now supports global page header as well as a per-post/page header.
Key functions are now hookable.
Add full phpDoc.
Props to the WordPress team and Twenty Ten for some of the phpDoc.
Fixes #2749, #2754, #2751.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpthemesbpdefault_inccssdefaultcss">trunk/bp-themes/bp-default/_inc/css/default.css</a></li>
<li><a href="#trunkbpthemesbpdefaultfunctionsphp">trunk/bp-themes/bp-default/functions.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpthemesbpdefault_inccssdefaultcss"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/_inc/css/default.css (3495 => 3496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/_inc/css/default.css        2010-11-29 13:13:35 UTC (rev 3495)
+++ trunk/bp-themes/bp-default/_inc/css/default.css        2010-12-01 21:16:41 UTC (rev 3496)
</span><span class="lines">@@ -70,7 +70,6 @@
</span><span class="cx"> #header {
</span><span class="cx">         position: relative;
</span><span class="cx">         color: #fff;
</span><del>-        background: url( ../images/default_header.jpg);
</del><span class="cx">         -moz-border-radius-bottomleft: 6px;
</span><span class="cx">         -webkit-border-bottom-left-radius: 6px;
</span><span class="cx">         -moz-border-radius-bottomright: 6px;
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/functions.php (3495 => 3496)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/functions.php        2010-11-29 13:13:35 UTC (rev 3495)
+++ trunk/bp-themes/bp-default/functions.php        2010-12-01 21:16:41 UTC (rev 3496)
</span><span class="lines">@@ -1,100 +1,295 @@
</span><span class="cx"> &lt;?php
</span><del>-// Stop the theme from killing WordPress if BuddyPress is not enabled.
-if ( !class_exists( 'BP_Core_User' ) )
-        return false;
</del><ins>+/**
+ * BP-Default theme functions and definitions
+ *
+ * Sets up the theme and provides some helper functions. Some helper functions
+ * are used in the theme as custom template tags. Others are attached to action and
+ * filter hooks in WordPress and BuddyPress to change core functionality.
+ *
+ * The first function, bp_dtheme_setup(), sets up the theme by registering support
+ * for various features in WordPress, such as post thumbnails and navigation menus, and
+ * for BuddyPress, action buttons and javascript localisation.
+ *
+ * When using a child theme (see http://codex.wordpress.org/Theme_Development, http://codex.wordpress.org/Child_Themes
+ * and http://codex.buddypress.org/theme-development/building-a-buddypress-child-theme/), you can override
+ * certain functions (those wrapped in a function_exists() call) by defining them first in your
+ * child theme's functions.php file. The child theme's functions.php file is included before the
+ * parent theme's file, so the child theme functions would be used.
+ *
+ * Functions that are not pluggable (not wrapped in function_exists()) are instead attached
+ * to a filter or action hook. The hook can be removed by using remove_action() or
+ * remove_filter() and you can attach your own function to the hook.
+ *
+ * For more information on hooks, actions, and filters, see http://codex.wordpress.org/Plugin_API.
+ *
+ * @package BuddyPress
+ * @subpackage BP-Default
+ * @since 1.2
+ */
</ins><span class="cx"> 
</span><del>-add_theme_support( 'automatic-feed-links' );
</del><ins>+if ( !function_exists( 'bp_dtheme_setup' ) ) :
+/**
+ * Sets up theme defaults and registers support for various WordPress and BuddyPress features.
+ *
+ * Note that this function is hooked into the after_setup_theme hook, which runs
+ * before the init hook. The init hook is too late for some features, such as indicating
+ * support post thumbnails.
+ *
+ * To override bp_dtheme_setup() in a child theme, add your own bp_dtheme_setup to your child theme's
+ * functions.php file.
+ *
+ * @global $bp The global BuddyPress settings variable created in bp_core_setup_globals()
+ * @since 1.3
+ */
+function bp_dtheme_setup() {
+        global $bp;
</ins><span class="cx"> 
</span><del>-// This theme allows users to set a custom background
-add_custom_background();
</del><ins>+        // Load the AJAX functions for the theme
+        require_once( TEMPLATEPATH . '/_inc/ajax.php' );
</ins><span class="cx"> 
</span><del>-// Register the widget columns
-// Area 1, located in the sidebar. Empty by default.
-register_sidebar( array(
-        'name'          =&gt; 'Sidebar',
-        'description'         =&gt; __( 'The sidebar widget area', 'buddypress' ),
-        'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
-        'after_widget'  =&gt; '&lt;/div&gt;',
-        'before_title'  =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-        'after_title'   =&gt; '&lt;/h3&gt;'
-) );
</del><ins>+        // This theme uses post thumbnails
+        add_theme_support( 'post-thumbnails' );
</ins><span class="cx"> 
</span><del>-// Area 2, located in the footer. Empty by default.
-register_sidebar( array(
-        'name' =&gt; __( 'First Footer Widget Area', 'buddypress' ),
-        'id' =&gt; 'first-footer-widget-area',
-        'description' =&gt; __( 'The first footer widget area', 'buddypress' ),
-        'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
-        'after_widget' =&gt; '&lt;/li&gt;',
-        'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-        'after_title' =&gt; '&lt;/h3&gt;',
-) );
</del><ins>+        // Add default posts and comments RSS feed links to head
+        add_theme_support( 'automatic-feed-links' );
</ins><span class="cx"> 
</span><del>-// Area 3, located in the footer. Empty by default.
-register_sidebar( array(
-        'name' =&gt; __( 'Second Footer Widget Area', 'buddypress' ),
-        'id' =&gt; 'second-footer-widget-area',
-        'description' =&gt; __( 'The second footer widget area', 'buddypress' ),
-        'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
-        'after_widget' =&gt; '&lt;/li&gt;',
-        'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-        'after_title' =&gt; '&lt;/h3&gt;',
-) );
</del><ins>+        // This theme uses wp_nav_menu() in one location.
+        register_nav_menus( array(
+                'primary' =&gt; __( 'Primary Navigation', 'buddypress' ),
+        ) );
</ins><span class="cx"> 
</span><del>-// Area 4, located in the footer. Empty by default.
-register_sidebar( array(
-        'name' =&gt; __( 'Third Footer Widget Area', 'buddypress' ),
-        'id' =&gt; 'third-footer-widget-area',
-        'description' =&gt; __( 'The third footer widget area', 'buddypress' ),
-        'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
-        'after_widget' =&gt; '&lt;/li&gt;',
-        'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-        'after_title' =&gt; '&lt;/h3&gt;',
-) );
</del><ins>+        // This theme allows users to set a custom background
+        add_custom_background();
</ins><span class="cx"> 
</span><del>-// Area 5, located in the footer. Empty by default.
-register_sidebar( array(
-        'name' =&gt; __( 'Fourth Footer Widget Area', 'buddypress' ),
-        'id' =&gt; 'fourth-footer-widget-area',
-        'description' =&gt; __( 'The fourth footer widget area', 'buddypress' ),
-        'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
-        'after_widget' =&gt; '&lt;/li&gt;',
-        'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
-        'after_title' =&gt; '&lt;/h3&gt;',
-) );
</del><ins>+        // Changeable header section starts here
+        define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
+        // No CSS. The %s is a placeholder for the theme template directory URI.
+        define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' );
</ins><span class="cx"> 
</span><del>-// Register navigation menu
-register_nav_menus( array(
-        'primary' =&gt; __( 'Primary Navigation', 'buddypress' ),
-) );
</del><ins>+        // The height and width of your custom header. You can hook into the theme's own filters to change these values.
+        // Add a filter to bp_dtheme_header_image_width and bp_dtheme_header_image_height to change these values.
+        define( 'HEADER_IMAGE_WIDTH', apply_filters( 'bp_dtheme_header_image_width', 1250 ) );
+        define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'bp_dtheme_header_image_height', 100 ) );
</ins><span class="cx"> 
</span><del>-// Load the AJAX functions for the theme
-require_once( TEMPLATEPATH . '/_inc/ajax.php' );
</del><ins>+        // We'll be using post thumbnails for custom header images on posts and pages. We want them to be 1250 pixels wide by 100 pixels tall.
+        // Larger images will be auto-cropped to fit, smaller ones will be ignored.
+        set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
</ins><span class="cx"> 
</span><del>-// Load the javascript for the theme
-wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
</del><ins>+        // Add a way for the custom header to be styled in the admin panel that controls custom headers.
+        add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
</ins><span class="cx"> 
</span><del>-// Add words that we need to use in JS to the end of the page so they can be translated and still used.
-$params = array(
-        'my_favs'           =&gt; __( 'My Favorites', 'buddypress' ),
-        'accepted'          =&gt; __( 'Accepted', 'buddypress' ),
-        'rejected'          =&gt; __( 'Rejected', 'buddypress' ),
-        'show_all_comments' =&gt; __( 'Show all comments for this thread', 'buddypress' ),
-        'show_all'          =&gt; __( 'Show all', 'buddypress' ),
-        'comments'          =&gt; __( 'comments', 'buddypress' ),
-        'close'             =&gt; __( 'Close', 'buddypress' )
-);
</del><ins>+        //End of changeable header section
</ins><span class="cx"> 
</span><del>-global $bp;
-if ( isset( $bp-&gt;displayed_user-&gt;id ) )
-        $params['mention_explain'] = sprintf( __( &quot;%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.&quot;, 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) );
</del><ins>+        // Load the javascript for the theme
+        wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
</ins><span class="cx"> 
</span><del>-wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
</del><ins>+        // Add words that we need to use in JS to the end of the page so they can be translated and still used.
+        $params = array(
+                'my_favs'           =&gt; __( 'My Favorites', 'buddypress' ),
+                'accepted'          =&gt; __( 'Accepted', 'buddypress' ),
+                'rejected'          =&gt; __( 'Rejected', 'buddypress' ),
+                'show_all_comments' =&gt; __( 'Show all comments for this thread', 'buddypress' ),
+                'show_all'          =&gt; __( 'Show all', 'buddypress' ),
+                'comments'          =&gt; __( 'comments', 'buddypress' ),
+                'close'             =&gt; __( 'Close', 'buddypress' )
+        );
</ins><span class="cx"> 
</span><ins>+        if ( !empty( $bp-&gt;displayed_user-&gt;id ) )
+                $params['mention_explain'] = sprintf( __( &quot;%s is a unique identifier for %s that you can type into any message on this site. %s will be sent a notification and a link to your message any time you use it.&quot;, 'buddypress' ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname( bp_get_displayed_user_fullname() ), bp_get_user_firstname( bp_get_displayed_user_fullname() ) );
+
+        wp_localize_script( 'dtheme-ajax-js', 'BP_DTheme', $params );
+
+        // Register buttons for the relevant component templates
+        // Friends button
+        if ( bp_is_active( 'friends' ) )
+                add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
+
+        // Activity button
+        if ( bp_is_active( 'activity' ) )
+                add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
+
+        // Messages button
+        if ( bp_is_active( 'messages' ) )
+                add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
+
+        // Group buttons
+        if ( bp_is_active( 'groups' ) ) {
+                add_action( 'bp_group_header_actions',     'bp_group_join_button' );
+                add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
+                add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
+        }
+
+        // Blog button
+        if ( bp_is_active( 'blogs' ) )
+                add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
+}
+add_action( 'after_setup_theme', 'bp_dtheme_setup' );
+endif;
+
+if ( !function_exists( 'bp_dtheme_admin_header_style' ) ) :
</ins><span class="cx"> /**
</span><ins>+ * Styles the header image displayed on the Appearance &gt; Header admin panel.
+ *
+ * Referenced via add_custom_image_header() in bp_dtheme_setup().
+ *
+ * @since 1.2
+ */
+function bp_dtheme_admin_header_style() {
+?&gt;
+        &lt;style type=&quot;text/css&quot;&gt;
+                #headimg {
+                        position: relative;
+                        color: #fff;
+                        background: url(&lt;?php header_image() ?&gt;);
+                        -moz-border-radius-bottomleft: 6px;
+                        -webkit-border-bottom-left-radius: 6px;
+                        -moz-border-radius-bottomright: 6px;
+                        -webkit-border-bottom-right-radius: 6px;
+                        margin-bottom: 20px;
+                        height: 100px;
+                        padding-top: 25px;
+                }
+
+                #headimg h1{
+                        position: absolute;
+                        bottom: 15px;
+                        left: 15px;
+                        width: 44%;
+                        margin: 0;
+                        font-family: Arial, Tahoma, sans-serif;
+                }
+                #headimg h1 a{
+                        color:#&lt;?php header_textcolor() ?&gt;;
+                        text-decoration: none;
+                        border-bottom: none;
+                }
+                #headimg #desc{
+                        color:#&lt;?php header_textcolor() ?&gt;;
+                        font-size:1em;
+                        margin-top:-0.5em;
+                }
+
+                #desc {
+                        display: none;
+                }
+
+                &lt;?php if ( 'blank' == get_header_textcolor() ) { ?&gt;
+                #headimg h1, #headimg #desc {
+                        display: none;
+                }
+                #headimg h1 a, #headimg #desc {
+                        color:#&lt;?php echo HEADER_TEXTCOLOR ?&gt;;
+                }
+                &lt;?php } ?&gt;
+        &lt;/style&gt;
+&lt;?php
+}
+endif;
+
+if ( !function_exists( 'bp_dtheme_header_style' ) ) :
+/**
+ * The styles for the post thumbnails / custom page headers.
+ *
+ * Referenced via add_custom_image_header() in bp_dtheme_setup().
+ *
+ * @global WP_Query $post The current WP_Query object for the current post or page
+ * @since 1.2
+ */
+function bp_dtheme_header_style() {
+        global $post;
+
+        if ( is_singular() &amp;&amp; has_post_thumbnail( $post-&gt;ID ) ) {
+                $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post-&gt;ID ), 'post-thumbnail' );
+
+                // $src, $width, $height
+                if ( !empty( $image ) &amp;&amp; $image[1] &gt;= HEADER_IMAGE_WIDTH )
+                        $header_image = $image[0];
+        }
+
+        if ( empty( $header_image ) )
+                $header_image = get_header_image();
+?&gt;
+        &lt;style type=&quot;text/css&quot;&gt;
+                #header { background-image: url(&lt;?php echo $header_image ?&gt;); }
+                &lt;?php if ( 'blank' == get_header_textcolor() ) { ?&gt;
+                #header h1, #header #desc { display: none; }
+                &lt;?php } else { ?&gt;
+                #header h1 a, #desc { color:#&lt;?php header_textcolor() ?&gt;; }
+                &lt;?php } ?&gt;
+        &lt;/style&gt;
+&lt;?php
+}
+endif;
+
+/**
+ * Register widgetised areas, including one sidebar and four widget-ready columns in the footer.
+ *
+ * To override bp_dtheme_widgets_init() in a child theme, remove the action hook and add your own
+ * function tied to the init hook.
+ *
+ * @since 1.3
+ */
+function bp_dtheme_widgets_init() {
+        // Register the widget columns
+        // Area 1, located in the sidebar. Empty by default.
+        register_sidebar( array(
+                'name'          =&gt; 'Sidebar',
+                'description'         =&gt; __( 'The sidebar widget area', 'buddypress' ),
+                'before_widget' =&gt; '&lt;div id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;',
+                'after_widget'  =&gt; '&lt;/div&gt;',
+                'before_title'  =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title'   =&gt; '&lt;/h3&gt;'
+        ) );
+
+        // Area 2, located in the footer. Empty by default.
+        register_sidebar( array(
+                'name' =&gt; __( 'First Footer Widget Area', 'buddypress' ),
+                'id' =&gt; 'first-footer-widget-area',
+                'description' =&gt; __( 'The first footer widget area', 'buddypress' ),
+                'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
+                'after_widget' =&gt; '&lt;/li&gt;',
+                'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title' =&gt; '&lt;/h3&gt;',
+        ) );
+
+        // Area 3, located in the footer. Empty by default.
+        register_sidebar( array(
+                'name' =&gt; __( 'Second Footer Widget Area', 'buddypress' ),
+                'id' =&gt; 'second-footer-widget-area',
+                'description' =&gt; __( 'The second footer widget area', 'buddypress' ),
+                'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
+                'after_widget' =&gt; '&lt;/li&gt;',
+                'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title' =&gt; '&lt;/h3&gt;',
+        ) );
+
+        // Area 4, located in the footer. Empty by default.
+        register_sidebar( array(
+                'name' =&gt; __( 'Third Footer Widget Area', 'buddypress' ),
+                'id' =&gt; 'third-footer-widget-area',
+                'description' =&gt; __( 'The third footer widget area', 'buddypress' ),
+                'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
+                'after_widget' =&gt; '&lt;/li&gt;',
+                'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title' =&gt; '&lt;/h3&gt;',
+        ) );
+
+        // Area 5, located in the footer. Empty by default.
+        register_sidebar( array(
+                'name' =&gt; __( 'Fourth Footer Widget Area', 'buddypress' ),
+                'id' =&gt; 'fourth-footer-widget-area',
+                'description' =&gt; __( 'The fourth footer widget area', 'buddypress' ),
+                'before_widget' =&gt; '&lt;li id=&quot;%1$s&quot; class=&quot;widget-container %2$s&quot;&gt;',
+                'after_widget' =&gt; '&lt;/li&gt;',
+                'before_title' =&gt; '&lt;h3 class=&quot;widgettitle&quot;&gt;',
+                'after_title' =&gt; '&lt;/h3&gt;',
+        ) );
+}
+add_action( 'widgets_init', 'bp_dtheme_widgets_init' );
+
+/**
</ins><span class="cx">  * Add the JS needed for blog comment replies
</span><span class="cx">  *
</span><del>- * @package BuddyPress Theme
</del><span class="cx">  * @since 1.2
</span><span class="cx">  */
</span><span class="cx"> function bp_dtheme_add_blog_comments_js() {
</span><span class="lines">@@ -103,14 +298,19 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
</span><span class="cx"> 
</span><ins>+if ( !function_exists( 'bp_dtheme_blog_comments' ) ) :
</ins><span class="cx"> /**
</span><del>- * HTML for outputting blog comments as defined by the WP comment API
</del><ins>+ * Template for comments and pingbacks.
</ins><span class="cx">  *
</span><ins>+ * To override this walker in a child theme without modifying the comments template
+ * simply create your own bp_dtheme_blog_comments(), and that function will be used instead.
+ *
+ * Used as a callback by wp_list_comments() for displaying the comments.
+ *
</ins><span class="cx">  * @param mixed $comment Comment record from database
</span><span class="cx">  * @param array $args Arguments from wp_list_comments() call
</span><span class="cx">  * @param int $depth Comment nesting level
</span><span class="cx">  * @see wp_list_comments()
</span><del>- * @package BuddyPress Theme
</del><span class="cx">  * @since 1.2
</span><span class="cx">  */
</span><span class="cx"> function bp_dtheme_blog_comments( $comment, $args, $depth ) {
</span><span class="lines">@@ -139,72 +339,22 @@
</span><span class="cx">                         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php if ( $comment-&gt;comment_approved == '0' ) : ?&gt;
</span><del>-                                 &lt;em class=&quot;moderate&quot;&gt;&lt;?php _e('Your comment is awaiting moderation.'); ?&gt;&lt;/em&gt;&lt;br /&gt;
</del><ins>+                                 &lt;em class=&quot;moderate&quot;&gt;&lt;?php _e( 'Your comment is awaiting moderation.', 'buddypress' ); ?&gt;&lt;/em&gt;&lt;br /&gt;
</ins><span class="cx">                         &lt;?php endif; ?&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;?php comment_text() ?&gt;
</span><span class="cx"> 
</span><span class="cx">                         &lt;div class=&quot;comment-options&quot;&gt;
</span><del>-                                &lt;?php echo comment_reply_link( array('depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth'] ) ) ?&gt;
-                                &lt;?php edit_comment_link( __( 'Edit' ),'','' ); ?&gt;
</del><ins>+                                &lt;?php echo comment_reply_link( array( 'depth' =&gt; $depth, 'max_depth' =&gt; $args['max_depth'] ) ) ?&gt;
+                                &lt;?php edit_comment_link( __( 'Edit', 'buddypress' ), '', '' ); ?&gt;
</ins><span class="cx">                         &lt;/div&gt;
</span><span class="cx"> 
</span><span class="cx">                 &lt;/div&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><ins>+endif;
</ins><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * In BuddyPress 1.2.x, this function filtered the dropdown on the Settings &gt; Reading screen for selecting
- * the page to show on front to include &quot;Activity Stream.&quot;
- * As of 1.3.x, it is no longer required.
- *
- * @deprecated 1.3
- * @deprecated No longer required.
- * @param string $page_html A list of pages as a dropdown (select list)
- * @return string
- * @see wp_dropdown_pages()
- * @since 1.2
- */
-function bp_dtheme_wp_pages_filter( $page_html ) {
-        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
-        return $page_html;
-}
-
-/**
- * In BuddyPress 1.2.x, this function hijacked the saving of page on front setting to save the activity stream setting.
- * As of 1.3.x, it is no longer required.
- *
- * @deprecated 1.3
- * @deprecated No longer required.
- * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
- * @param $string $oldvalue New value of get_option( 'page_on_front' )
- * @return string
- * @since 1.2
- */
-function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
-        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
-        if ( !is_admin() || !is_super_admin() )
-                return false;
-
-        return $oldvalue;
-}
-
-/**
- * In BuddyPress 1.2.x, this function loaded the activity stream template if the front page display settings allow.
- * As of 1.3.x, it is no longer required.
- *
- * @deprecated 1.3
- * @deprecated No longer required.
- * @param string $template Absolute path to the page template 
- * @return string
- * @since 1.2
- */
-function bp_dtheme_page_on_front_template( $template ) {
-        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
-        return $template;
-}
-
-/**
</del><span class="cx">  * Return the ID of a page set as the home page.
</span><span class="cx">  *
</span><span class="cx">  * @return false|int ID of page set as the home page
</span><span class="lines">@@ -218,39 +368,12 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * In BuddyPress 1.2.x, this forced the page ID as a string to stop the get_posts query from kicking up a fuss.
- * As of 1.3.x, it is no longer required.
</del><ins>+ * Add secondary avatar image to this activity stream's record, if supported.
</ins><span class="cx">  *
</span><del>- * @deprecated 1.3
- * @deprecated No longer required.
- * @since 1.2
- */
-function bp_dtheme_fix_get_posts_on_activity_front() {
-        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
-}
-
-/**
- * In BuddyPress 1.3, this was used as part of the code that set the activity stream to be on the front page.
- * As of 1.3.x, it is no longer required.
- *
- * @deprecated 1.3
- * @deprecated No longer required.
- * @param array $posts Posts as retrieved by WP_Query
- * @return array
- * @since 1.2.5
- */
-function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
-        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
-        return $posts;
-}
-
-/**
- * Add secondary avatar image to this activity stream's record, if supported
- *
</del><span class="cx">  * @param string $action The text of this activity
</span><span class="cx">  * @param BP_Activity_Activity $activity Activity object
</span><ins>+ * @package BuddyPress Theme
</ins><span class="cx">  * @return string
</span><del>- * @package BuddyPress Theme
</del><span class="cx">  * @since 1.2.6
</span><span class="cx">  */
</span><span class="cx"> function bp_dtheme_activity_secondary_avatars( $action, $activity ) {
</span><span class="lines">@@ -272,89 +395,8 @@
</span><span class="cx"> add_filter( 'bp_get_activity_action_pre_meta', 'bp_dtheme_activity_secondary_avatars', 10, 2 );
</span><span class="cx"> 
</span><span class="cx"> /**
</span><del>- * Custom header image support. You can remove this entirely in a child theme by adding this line
- * to your functions.php: define( 'BP_DTHEME_DISABLE_CUSTOM_HEADER', true );
- *
- * @package BuddyPress Theme
- * @since 1.2
- */
-function bp_dtheme_add_custom_header_support() {
-        // Set the defaults for the custom header image (http://ryan.boren.me/2007/01/07/custom-image-header-api/)
-        define( 'HEADER_TEXTCOLOR', 'FFFFFF' );
-        define( 'HEADER_IMAGE', '%s/_inc/images/default_header.jpg' ); // %s is theme dir uri
-        define( 'HEADER_IMAGE_WIDTH', 1250 );
-        define( 'HEADER_IMAGE_HEIGHT', 125 );
-
-        function bp_dtheme_header_style() { ?&gt;
-                &lt;style type=&quot;text/css&quot;&gt;
-                        #header { background-image: url(&lt;?php header_image() ?&gt;); }
-                        &lt;?php if ( 'blank' == get_header_textcolor() ) { ?&gt;
-                        #header h1, #header #desc { display: none; }
-                        &lt;?php } else { ?&gt;
-                        #header h1 a, #desc { color:#&lt;?php header_textcolor() ?&gt;; }
-                        &lt;?php } ?&gt;
-                &lt;/style&gt;
-        &lt;?php
-        }
-
-        function bp_dtheme_admin_header_style() { ?&gt;
-                &lt;style type=&quot;text/css&quot;&gt;
-                        #headimg {
-                                position: relative;
-                                color: #fff;
-                                background: url(&lt;?php header_image() ?&gt;);
-                                -moz-border-radius-bottomleft: 6px;
-                                -webkit-border-bottom-left-radius: 6px;
-                                -moz-border-radius-bottomright: 6px;
-                                -webkit-border-bottom-right-radius: 6px;
-                                margin-bottom: 20px;
-                                height: 100px;
-                                padding-top: 25px;
-                        }
-
-                        #headimg h1{
-                                position: absolute;
-                                bottom: 15px;
-                                left: 15px;
-                                width: 44%;
-                                margin: 0;
-                                font-family: Arial, Tahoma, sans-serif;
-                        }
-                        #headimg h1 a{
-                                color:#&lt;?php header_textcolor() ?&gt;;
-                                text-decoration: none;
-                                border-bottom: none;
-                        }
-                        #headimg #desc{
-                                color:#&lt;?php header_textcolor() ?&gt;;
-                                font-size:1em;
-                                margin-top:-0.5em;
-                        }
-
-                        #desc {
-                                display: none;
-                        }
-
-                        &lt;?php if ( 'blank' == get_header_textcolor() ) { ?&gt;
-                        #headimg h1, #headimg #desc {
-                                display: none;
-                        }
-                        #headimg h1 a, #headimg #desc {
-                                color:#&lt;?php echo HEADER_TEXTCOLOR ?&gt;;
-                        }
-                        &lt;?php } ?&gt;
-                &lt;/style&gt;
-        &lt;?php
-        }
-        add_custom_image_header( 'bp_dtheme_header_style', 'bp_dtheme_admin_header_style' );
-}
-if ( !defined( 'BP_DTHEME_DISABLE_CUSTOM_HEADER' ) )
-        add_action( 'init', 'bp_dtheme_add_custom_header_support' );
-
-/**
</del><span class="cx">  * Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html)
</span><span class="cx">  *
</span><del>- * @package BuddyPress Theme
</del><span class="cx">  * @since 1.2
</span><span class="cx">  */
</span><span class="cx"> function bp_dtheme_show_notice() { ?&gt;
</span><span class="lines">@@ -391,24 +433,83 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Member Buttons
-if ( bp_is_active( 'friends' ) )
-        add_action( 'bp_member_header_actions',    'bp_add_friend_button' );
</del><ins>+// Everything beyond this point is deprecated as of BuddyPress 1.3. This will be removed in a future version.
</ins><span class="cx"> 
</span><del>-if ( bp_is_active( 'activity' ) )
-        add_action( 'bp_member_header_actions',    'bp_send_public_message_button' );
</del><ins>+/**
+ * In BuddyPress 1.2.x, this function filtered the dropdown on the Settings &gt; Reading screen for selecting
+ * the page to show on front to include &quot;Activity Stream.&quot;
+ * As of 1.3.x, it is no longer required.
+ *
+ * @deprecated 1.3
+ * @deprecated No longer required.
+ * @param string $page_html A list of pages as a dropdown (select list)
+ * @return string
+ * @see wp_dropdown_pages()
+ * @since 1.2
+ */
+function bp_dtheme_wp_pages_filter( $page_html ) {
+        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
+        return $page_html;
+}
</ins><span class="cx"> 
</span><del>-if ( bp_is_active( 'messages' ) )
-        add_action( 'bp_member_header_actions',    'bp_send_private_message_button' );
</del><ins>+/**
+ * In BuddyPress 1.2.x, this function hijacked the saving of page on front setting to save the activity stream setting.
+ * As of 1.3.x, it is no longer required.
+ *
+ * @deprecated 1.3
+ * @deprecated No longer required.
+ * @param $string $oldvalue Previous value of get_option( 'page_on_front' )
+ * @param $string $oldvalue New value of get_option( 'page_on_front' )
+ * @return string
+ * @since 1.2
+ */
+function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
+        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
+        if ( !is_admin() || !is_super_admin() )
+                return false;
</ins><span class="cx"> 
</span><del>-// Group Buttons
-if ( bp_is_active( 'groups' ) ) {
-        add_action( 'bp_group_header_actions',     'bp_group_join_button' );
-        add_action( 'bp_group_header_actions',     'bp_group_new_topic_button' );
-        add_action( 'bp_directory_groups_actions', 'bp_group_join_button' );
</del><ins>+        return $oldvalue;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// Blog Buttons
-if ( bp_is_active( 'blogs' ) )
-        add_action( 'bp_directory_blogs_actions',  'bp_blogs_visit_blog_button' );
</del><ins>+/**
+ * In BuddyPress 1.2.x, this function loaded the activity stream template if the front page display settings allow.
+ * As of 1.3.x, it is no longer required.
+ *
+ * @deprecated 1.3
+ * @deprecated No longer required.
+ * @param string $template Absolute path to the page template 
+ * @return string
+ * @since 1.2
+ */
+function bp_dtheme_page_on_front_template( $template ) {
+        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
+        return $template;
+}
+
+/**
+ * In BuddyPress 1.2.x, this forced the page ID as a string to stop the get_posts query from kicking up a fuss.
+ * As of 1.3.x, it is no longer required.
+ *
+ * @deprecated 1.3
+ * @deprecated No longer required.
+ * @since 1.2
+ */
+function bp_dtheme_fix_get_posts_on_activity_front() {
+        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
+}
+
+/**
+ * In BuddyPress 1.3, this was used as part of the code that set the activity stream to be on the front page.
+ * As of 1.3.x, it is no longer required.
+ *
+ * @deprecated 1.3
+ * @deprecated No longer required.
+ * @param array $posts Posts as retrieved by WP_Query
+ * @return array
+ * @since 1.2.5
+ */
+function bp_dtheme_fix_the_posts_on_activity_front( $posts ) {
+        _deprecated_function( __FUNCTION__, '1.3', &quot;No longer required.&quot; );
+        return $posts;
+}
</ins><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>