<!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] [3005] branches/1.2/bp-core/bp-core-templatetags.php:
Organize core template functions.</title>
</head>
<body>
<div id="msg">
<dl>
<dt>Revision</dt> <dd>3005</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-05-17 08:59:06 +0000 (Mon, 17 May 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Organize core template functions.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches12bpcorebpcoretemplatetagsphp">branches/1.2/bp-core/bp-core-templatetags.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches12bpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: branches/1.2/bp-core/bp-core-templatetags.php (3004 => 3005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/1.2/bp-core/bp-core-templatetags.php        2010-05-17 08:33:57 UTC (rev 3004)
+++ branches/1.2/bp-core/bp-core-templatetags.php        2010-05-17 08:59:06 UTC (rev 3005)
</span><span class="lines">@@ -656,79 +656,12 @@
</span><span class="cx">         echo '<img id="avatar-to-crop" class="avatar" src="' . $bp->avatar_admin->image . '" />';
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+/** OTHER TEMPLATE TAGS *******************************************************/
+
</ins><span class="cx"> function bp_site_name() {
</span><span class="cx">         echo apply_filters( 'bp_site_name', get_blog_option( BP_ROOT_BLOG, 'blogname' ) );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function bp_is_my_profile() {
-        global $bp;
-
-        if ( is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
-                $my_profile = true;
-        else
-                $my_profile = false;
-
-        return apply_filters( 'bp_is_my_profile', $my_profile );
-}
-function bp_is_home() { return bp_is_my_profile(); }
-
-function bp_user_has_access() {
-        global $bp;
-
-        if ( is_site_admin() || is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
-                $has_access = true;
-        else
-                $has_access = false;
-
-        return apply_filters( 'bp_user_has_access', $has_access );
-}
-
-function bp_last_activity( $user_id = false, $echo = true ) {
-        global $bp;
-
-        if ( !$user_id )
-                $user_id = $bp->displayed_user->id;
-
-        $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
-
-        if ( $echo )
-                echo apply_filters( 'bp_last_activity', $last_activity );
-        else
-                return apply_filters( 'bp_last_activity', $last_activity );
-}
-
-function bp_user_firstname() {
-        echo bp_get_user_firstname();
-}
-        function bp_get_user_firstname( $name = false ) {
-                global $bp;
-
-                if ( !$name )
-                        $name = $bp->loggedin_user->fullname;
-
-                $fullname = (array)explode( ' ', $name );
-
-                return apply_filters( 'bp_get_user_firstname', $fullname[0], $fullname );
-        }
-
-function bp_user_link() {
-        global $bp;
-
-        echo apply_filters( 'bp_user_link', $bp->displayed_user->domain );
-}
-
-function bp_get_loggedin_user_link() {
-        global $bp;
-
-        return $bp->loggedin_user->domain;
-}
-
-function bp_get_displayed_user_link() {
-        global $bp;
-
-        return $bp->displayed_user->domain;
-}
-
</del><span class="cx"> function bp_core_get_wp_profile() {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span><span class="lines">@@ -865,30 +798,10 @@
</span><span class="cx">         }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function bp_loggedinuser_link() {
-        global $bp;
-
-        if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) ) {
-                echo apply_filters( 'bp_loggedinuser_link', $link );
-        }
-}
-
</del><span class="cx"> function bp_get_plugin_sidebar() {
</span><span class="cx">         locate_template( array( 'plugin-sidebar.php' ), true );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function bp_is_blog_page() {
-        global $bp, $is_member_page, $wp_query;
-
-        if ( $wp_query->is_home && !$bp->is_directory )
-                return true;
-
-        if ( !$bp->displayed_user->id && !$bp->is_single_item && !$bp->is_directory && !bp_core_is_root_component( $bp->current_component ) )
-                return true;
-
-        return false;
-}
-
</del><span class="cx"> function bp_page_title() {
</span><span class="cx">         echo bp_get_page_title();
</span><span class="cx"> }
</span><span class="lines">@@ -1055,12 +968,6 @@
</span><span class="cx">         do_action( 'bp_custom_profile_sidebar_boxes' );
</span><span class="cx"> }
</span><span class="cx">
</span><del>-function bp_is_directory() {
-        global $bp;
-
-        return $bp->is_directory;
-}
-
</del><span class="cx"> /**
</span><span class="cx"> * bp_create_excerpt()
</span><span class="cx"> *
</span><span class="lines">@@ -1301,6 +1208,69 @@
</span><span class="cx"> /* Template functions for fetching globals, without querying the DB again
</span><span class="cx"> also means we dont have to use the $bp variable in the template (looks messy) */
</span><span class="cx">
</span><ins>+function bp_last_activity( $user_id = false, $echo = true ) {
+        global $bp;
+
+        if ( !$user_id )
+                $user_id = $bp->displayed_user->id;
+
+        $last_activity = bp_core_get_last_activity( get_usermeta( $user_id, 'last_activity' ), __('active %s ago', 'buddypress') );
+
+        if ( $echo )
+                echo apply_filters( 'bp_last_activity', $last_activity );
+        else
+                return apply_filters( 'bp_last_activity', $last_activity );
+}
+
+function bp_user_has_access() {
+        global $bp;
+
+        if ( is_site_admin() || is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
+                $has_access = true;
+        else
+                $has_access = false;
+
+        return apply_filters( 'bp_user_has_access', $has_access );
+}
+
+function bp_user_firstname() {
+        echo bp_get_user_firstname();
+}
+        function bp_get_user_firstname( $name = false ) {
+                global $bp;
+
+                if ( !$name )
+                        $name = $bp->loggedin_user->fullname;
+
+                $fullname = (array)explode( ' ', $name );
+
+                return apply_filters( 'bp_get_user_firstname', $fullname[0], $fullname );
+        }
+
+function bp_user_link() {
+        echo apply_filters( 'bp_user_link', bp_get_loggedin_user_link() );
+}
+        function bp_get_loggedin_user_link() {
+                global $bp;
+
+                return apply_filters( 'bp_get_loggedin_user_link', $bp->loggedin_user->domain );
+        }
+
+function bp_loggedin_user_link() {
+        global $bp;
+
+        if ( $link = bp_core_get_userlink( $bp->loggedin_user->id ) )
+                echo apply_filters( 'bp_loggedin_user_link', $link );
+}
+/* @todo Deprecate incorrectly named function? */
+function bp_loggedinuser_link() { bp_loggedin_user_link(); }
+
+function bp_get_displayed_user_link() {
+        global $bp;
+
+        return apply_filters( 'bp_get_displayed_user_link', $bp->displayed_user->domain );
+}
+
</ins><span class="cx"> function bp_displayed_user_id() {
</span><span class="cx">         global $bp;
</span><span class="cx">         return apply_filters( 'bp_displayed_user_id', $bp->displayed_user->id );
</span><span class="lines">@@ -1388,6 +1358,30 @@
</span><span class="cx">
</span><span class="cx"> /* Template is_() functions to determine the current page */
</span><span class="cx">
</span><ins>+function bp_is_blog_page() {
+        global $bp, $is_member_page, $wp_query;
+
+        if ( $wp_query->is_home && !$bp->is_directory )
+                return true;
+
+        if ( !$bp->displayed_user->id && !$bp->is_single_item && !$bp->is_directory && !bp_core_is_root_component( $bp->current_component ) )
+                return true;
+
+        return false;
+}
+
+function bp_is_my_profile() {
+        global $bp;
+
+        if ( is_user_logged_in() && $bp->loggedin_user->id == $bp->displayed_user->id )
+                $my_profile = true;
+        else
+                $my_profile = false;
+
+        return apply_filters( 'bp_is_my_profile', $my_profile );
+}
+function bp_is_home() { return bp_is_my_profile(); }
+
</ins><span class="cx"> function bp_is_front_page() {
</span><span class="cx">         if ( 'posts' == get_option('show_on_front') && is_home() )
</span><span class="cx">                 return true;
</span><span class="lines">@@ -1401,6 +1395,12 @@
</span><span class="cx">         return ( 'page' == get_option('show_on_front') && 'activity' == get_option('page_on_front') && $_SERVER['REQUEST_URI'] == bp_core_get_site_path() );
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+function bp_is_directory() {
+        global $bp;
+
+        return $bp->is_directory;
+}
+
</ins><span class="cx"> function bp_is_page($page) {
</span><span class="cx">         global $bp;
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>