<!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] [2696] trunk:
  Moving the firstname template function into the core so that template files are not tied to functions in functions
 .php of the default.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2696</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-02-12 12:48:30 +0000 (Fri, 12 Feb 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Moving the firstname template function into the core so that template files are not tied to functions in functions.php of the default. Remove deprecated code and added to back compat plugin.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpblogsphp">trunk/bp-blogs.php</a></li>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpthemesbpdefaultactivitypostformphp">trunk/bp-themes/bp-default/activity/post-form.php</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="trunkbpblogsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs.php (2695 => 2696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs.php        2010-02-12 12:31:49 UTC (rev 2695)
+++ trunk/bp-blogs.php        2010-02-12 12:48:30 UTC (rev 2696)
</span><span class="lines">@@ -131,11 +131,6 @@
</span><span class="cx"> 
</span><span class="cx">         $blogs_link = $bp-&gt;loggedin_user-&gt;domain . $bp-&gt;blogs-&gt;slug . '/';
</span><span class="cx"> 
</span><del>-        /* Add the subnav items to the blogs nav item */
-        bp_core_new_subnav_item( array( 'name' =&gt; __( 'My Blogs', 'buddypress' ), 'slug' =&gt; 'my-blogs', 'parent_url' =&gt; $blogs_link, 'parent_slug' =&gt; $bp-&gt;blogs-&gt;slug, 'screen_function' =&gt; 'bp_blogs_screen_my_blogs', 'position' =&gt; 10, 'item_css_id' =&gt; 'my-blogs-list' ) );
-        bp_core_new_subnav_item( array( 'name' =&gt; __( 'Recent Posts', 'buddypress' ), 'slug' =&gt; 'recent-posts', 'parent_url' =&gt; $blogs_link, 'parent_slug' =&gt; $bp-&gt;blogs-&gt;slug, 'screen_function' =&gt; 'bp_blogs_screen_recent_posts', 'position' =&gt; 20 ) );
-        bp_core_new_subnav_item( array( 'name' =&gt; __( 'Recent Comments', 'buddypress' ), 'slug' =&gt; 'recent-comments', 'parent_url' =&gt; $blogs_link, 'parent_slug' =&gt; $bp-&gt;blogs-&gt;slug, 'screen_function' =&gt; 'bp_blogs_screen_recent_comments', 'position' =&gt; 30 ) );
-
</del><span class="cx">         /* Set up the component options navigation for Blog */
</span><span class="cx">         if ( 'blogs' == $bp-&gt;current_component ) {
</span><span class="cx">                 if ( bp_is_my_profile() ) {
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (2695 => 2696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-02-12 12:31:49 UTC (rev 2695)
+++ trunk/bp-core/bp-core-templatetags.php        2010-02-12 12:48:30 UTC (rev 2696)
</span><span class="lines">@@ -685,6 +685,20 @@
</span><span class="cx">                 return apply_filters( 'bp_last_activity', $last_activity );
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function bp_user_firstname() {
+        echo bp_get_user_firstname();
+}
+        function bp_get_user_firstname( $name = false ) {
+                global $bp;
+
+                if ( !$name )
+                        $name = $bp-&gt;loggedin_user-&gt;fullname;
+
+                $fullname = (array)explode( ' ', $name );
+
+                return apply_filters( 'bp_get_user_firstname', $fullname[0], $fullname );
+        }
+
</ins><span class="cx"> function bp_user_link() {
</span><span class="cx">         global $bp;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultactivitypostformphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/activity/post-form.php (2695 => 2696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/activity/post-form.php        2010-02-12 12:31:49 UTC (rev 2695)
+++ trunk/bp-themes/bp-default/activity/post-form.php        2010-02-12 12:48:30 UTC (rev 2696)
</span><span class="lines">@@ -16,9 +16,9 @@
</span><span class="cx"> 
</span><span class="cx">         &lt;h5&gt;
</span><span class="cx">                 &lt;?php if ( bp_is_group() ) : ?&gt;
</span><del>-                        &lt;?php printf( __( &quot;What's new in %s, %s?&quot;, 'buddypress' ), bp_get_group_name(), bp_dtheme_firstname() ) ?&gt;
</del><ins>+                        &lt;?php printf( __( &quot;What's new in %s, %s?&quot;, 'buddypress' ), bp_get_group_name(), bp_get_user_firstname() ) ?&gt;
</ins><span class="cx">                 &lt;?php else : ?&gt;
</span><del>-                        &lt;?php printf( __( &quot;What's new %s?&quot;, 'buddypress' ), bp_dtheme_firstname() ) ?&gt;
</del><ins>+                        &lt;?php printf( __( &quot;What's new %s?&quot;, 'buddypress' ), bp_get_user_firstname() ) ?&gt;
</ins><span class="cx">                 &lt;?php endif; ?&gt;
</span><span class="cx">         &lt;/h5&gt;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpthemesbpdefaultfunctionsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-themes/bp-default/functions.php (2695 => 2696)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-themes/bp-default/functions.php        2010-02-12 12:31:49 UTC (rev 2695)
+++ trunk/bp-themes/bp-default/functions.php        2010-02-12 12:48:30 UTC (rev 2696)
</span><span class="lines">@@ -21,26 +21,13 @@
</span><span class="cx"> /* Load the javascript for the theme */
</span><span class="cx"> wp_enqueue_script( 'dtheme-ajax-js', get_template_directory_uri() . '/_inc/global.js', array( 'jquery' ) );
</span><span class="cx"> 
</span><del>-function bp_dtheme_firstname( $name = false, $echo = false ) {
-        global $bp;
-
-        if ( !$name )
-                $name = $bp-&gt;loggedin_user-&gt;fullname;
-
-        $fullname = (array)explode( ' ', $name );
-        $firstname = apply_filters( 'bp_dtheme_firstname', $fullname[0], $fullname );
-
-        if ( $echo )
-                echo $firstname;
-        else
-                return $firstname;
-}
-
</del><ins>+/* Add the JS needed for blog comment replies */
</ins><span class="cx"> function bp_dtheme_add_blog_comments_js() {
</span><span class="cx">         if ( is_singular() ) wp_enqueue_script( 'comment-reply' );
</span><span class="cx"> }
</span><span class="cx"> add_action( 'template_redirect', 'bp_dtheme_add_blog_comments_js' );
</span><span class="cx"> 
</span><ins>+/* HTML for outputting blog comments as defined by the WP comment API */
</ins><span class="cx"> function bp_dtheme_blog_comments( $comment, $args, $depth ) {
</span><span class="cx">         $GLOBALS['comment'] = $comment; ?&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -82,6 +69,7 @@
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+/* Filter the dropdown for selecting the page to show on front to include &quot;Activity Stream&quot; */
</ins><span class="cx"> function bp_dtheme_wp_pages_filter( $page_html ) {
</span><span class="cx">         if ( 'page_on_front' != substr( $page_html, 14, 13 ) )
</span><span class="cx">                 return $page_html;
</span><span class="lines">@@ -97,6 +85,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_filter( 'wp_dropdown_pages', 'bp_dtheme_wp_pages_filter' );
</span><span class="cx"> 
</span><ins>+/* Hijack the saving of page on front setting to save the activity stream setting */
</ins><span class="cx"> function bp_dtheme_page_on_front_update( $oldvalue, $newvalue ) {
</span><span class="cx">         if ( !is_admin() || !is_site_admin() )
</span><span class="cx">                 return false;
</span><span class="lines">@@ -108,6 +97,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'pre_update_option_page_on_front', 'bp_dtheme_page_on_front_update', 10, 2 );
</span><span class="cx"> 
</span><ins>+/* Load the activity stream template if settings allow */
</ins><span class="cx"> function bp_dtheme_page_on_front_template( $template ) {
</span><span class="cx">         global $wp_query;
</span><span class="cx"> 
</span><span class="lines">@@ -211,16 +201,7 @@
</span><span class="cx"> }
</span><span class="cx"> add_action( 'init', 'bp_dtheme_add_custom_header_support' );
</span><span class="cx"> 
</span><del>-function bp_dtheme_remove_redundant() {
-        global $bp;
-
-        /* Remove the navigation options we do not need in this theme. */
-        bp_core_remove_subnav_item( $bp-&gt;blogs-&gt;slug, 'my-blogs' );
-        bp_core_remove_subnav_item( $bp-&gt;blogs-&gt;slug, 'recent-posts' );
-        bp_core_remove_subnav_item( $bp-&gt;blogs-&gt;slug, 'recent-comments' );
-}
-add_action( 'init', 'bp_dtheme_remove_redundant' );
-
</del><ins>+/* Show a notice to the user in wp-admin when the theme is activated */
</ins><span class="cx"> function bp_dtheme_show_notice() { ?&gt;
</span><span class="cx">         &lt;div id=&quot;message&quot; class=&quot;updated fade&quot;&gt;
</span><span class="cx">                 &lt;p&gt;&lt;?php printf( __( 'Theme activated! This theme contains &lt;a href=&quot;%s&quot;&gt;custom header image&lt;/a&gt; support and &lt;a href=&quot;%s&quot;&gt;sidebar widgets&lt;/a&gt;.', 'buddypress' ), admin_url( 'themes.php?page=custom-header' ), admin_url( 'widgets.php' ) ) ?&gt;&lt;/p&gt;
</span><span class="lines">@@ -229,6 +210,8 @@
</span><span class="cx">         &lt;style type=&quot;text/css&quot;&gt;#message2, #message0 { display: none; }&lt;/style&gt;
</span><span class="cx">         &lt;?php
</span><span class="cx"> }
</span><ins>+if ( is_admin() &amp;&amp; isset($_GET['activated'] ) &amp;&amp; $pagenow == &quot;themes.php&quot; )
+        add_action( 'admin_notices', 'bp_dtheme_show_notice' );
</ins><span class="cx"> 
</span><span class="cx"> /* Add words that we need to use in JS to the end of the page so they can be translated and still used. */
</span><span class="cx"> function bp_dtheme_js_terms() { ?&gt;
</span><span class="lines">@@ -240,17 +223,10 @@
</span><span class="cx">         var bp_terms_show_all = '&lt;?php _e( &quot;Show all&quot;, &quot;buddypress&quot; ) ?&gt;';
</span><span class="cx">         var bp_terms_comments = '&lt;?php _e( &quot;comments&quot;, &quot;buddypress&quot; ) ?&gt;';
</span><span class="cx">         var bp_terms_close = '&lt;?php _e( &quot;Close&quot;, &quot;buddypress&quot; ) ?&gt;';
</span><del>-        var bp_terms_mention_explain = '&lt;?php printf( __( &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;, &quot;buddypress&quot; ), '@' . bp_get_displayed_user_username(), bp_dtheme_firstname(bp_get_displayed_user_fullname()), bp_dtheme_firstname(bp_get_displayed_user_fullname()) ); ?&gt;';
</del><ins>+        var bp_terms_mention_explain = '&lt;?php printf( __( &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;, &quot;buddypress&quot; ), '@' . bp_get_displayed_user_username(), bp_get_user_firstname(bp_get_displayed_user_fullname()), bp_get_user_firstname(bp_get_displayed_user_fullname()) ); ?&gt;';
</ins><span class="cx">         &lt;/script&gt;
</span><span class="cx"> &lt;?php
</span><span class="cx"> }
</span><span class="cx"> add_action( 'wp_footer', 'bp_dtheme_js_terms' );
</span><span class="cx"> 
</span><del>-
-/* Show a notice when the theme is activated - workaround by Ozh (http://old.nabble.com/Activation-hook-exist-for-themes--td25211004.html) */
-if ( is_admin() &amp;&amp; isset($_GET['activated'] ) &amp;&amp; $pagenow == &quot;themes.php&quot; ) {
-        add_action( 'admin_notices', 'bp_dtheme_show_notice' );
-}
-
-
</del><span class="cx"> ?&gt;
</span><span class="cx">\ No newline at end of file
</span></span></pre>
</div>
</div>

</body>
</html>