<!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] [2950] trunk: Return and echo functions for pagination counts.</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>2950</dd>
<dt>Author</dt> <dd>apeatling</dd>
<dt>Date</dt> <dd>2010-04-24 15:34:25 +0000 (Sat, 24 Apr 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Return and echo functions for pagination counts.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpcorebpcoretemplatetagsphp">trunk/bp-core/bp-core-templatetags.php</a></li>
<li><a href="#trunkbpforumsbpforumstemplatetagsphp">trunk/bp-forums/bp-forums-templatetags.php</a></li>
<li><a href="#trunkbpgroupsbpgroupstemplatetagsphp">trunk/bp-groups/bp-groups-templatetags.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 (2949 => 2950)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-04-21 13:13:15 UTC (rev 2949)
+++ trunk/bp-core/bp-core-templatetags.php        2010-04-24 15:34:25 UTC (rev 2950)
</span><span class="lines">@@ -173,23 +173,26 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> function bp_members_pagination_count() {
</span><del>-        global $bp, $members_template;
</del><ins>+        echo bp_get_members_pagination_count();
+}
+        function bp_get_members_pagination_count() {
+                global $bp, $members_template;
</ins><span class="cx"> 
</span><del>-        $from_num = bp_core_number_format( intval( ( $members_template-&gt;pag_page - 1 ) * $members_template-&gt;pag_num ) + 1 );
-        $to_num = bp_core_number_format( ( $from_num + ( $members_template-&gt;pag_num - 1 ) &gt; $members_template-&gt;total_member_count ) ? $members_template-&gt;total_member_count : $from_num + ( $members_template-&gt;pag_num - 1) );
-        $total = bp_core_number_format( $members_template-&gt;total_member_count );
</del><ins>+                $from_num = bp_core_number_format( intval( ( $members_template-&gt;pag_page - 1 ) * $members_template-&gt;pag_num ) + 1 );
+                $to_num = bp_core_number_format( ( $from_num + ( $members_template-&gt;pag_num - 1 ) &gt; $members_template-&gt;total_member_count ) ? $members_template-&gt;total_member_count : $from_num + ( $members_template-&gt;pag_num - 1) );
+                $total = bp_core_number_format( $members_template-&gt;total_member_count );
</ins><span class="cx"> 
</span><del>-        if ( 'active' == $members_template-&gt;type )
-                echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
-        else if ( 'popular' == $members_template-&gt;type )
-                echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
-        else if ( 'online' == $members_template-&gt;type )
-                echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
-        else
-                echo sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
</del><ins>+                if ( 'active' == $members_template-&gt;type )
+                        $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s active members)', 'buddypress' ), $from_num, $to_num, $total );
+                else if ( 'popular' == $members_template-&gt;type )
+                        $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members with friends)', 'buddypress' ), $from_num, $to_num, $total );
+                else if ( 'online' == $members_template-&gt;type )
+                        $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members online)', 'buddypress' ), $from_num, $to_num, $total );
+                else
+                        $pag = sprintf( __( 'Viewing member %1$s to %2$s (of %3$s members)', 'buddypress' ), $from_num, $to_num, $total );
</ins><span class="cx"> 
</span><del>-        ?&gt;&lt;span class=&quot;ajax-loader&quot;&gt;&lt;/span&gt;&lt;?php
-}
</del><ins>+                return apply_filters( 'bp_members_pagination_count', $pag );
+        }
</ins><span class="cx"> 
</span><span class="cx"> function bp_members_pagination_links() {
</span><span class="cx">         echo bp_get_members_pagination_links();
</span></span></pre></div>
<a id="trunkbpforumsbpforumstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-templatetags.php (2949 => 2950)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-templatetags.php        2010-04-21 13:13:15 UTC (rev 2949)
+++ trunk/bp-forums/bp-forums-templatetags.php        2010-04-24 15:34:25 UTC (rev 2950)
</span><span class="lines">@@ -661,21 +661,21 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> function bp_forum_pagination_count() {
</span><del>-        global $bp, $forum_template;
</del><ins>+        echo bp_get_forum_pagination_count();
+}
+        function bp_get_forum_pagination_count() {
+                global $bp, $forum_template;
</ins><span class="cx"> 
</span><del>-        $from_num = bp_core_number_format( intval( ( $forum_template-&gt;pag_page - 1 ) * $forum_template-&gt;pag_num ) + 1 );
-        $to_num = bp_core_number_format( ( $from_num + ( $forum_template-&gt;pag_num - 1  ) &gt; $forum_template-&gt;total_topic_count ) ? $forum_template-&gt;total_topic_count : $from_num + ( $forum_template-&gt;pag_num - 1 ) );
-        $total = bp_core_number_format( $forum_template-&gt;total_topic_count );
</del><ins>+                $from_num = bp_core_number_format( intval( ( $forum_template-&gt;pag_page - 1 ) * $forum_template-&gt;pag_num ) + 1 );
+                $to_num = bp_core_number_format( ( $from_num + ( $forum_template-&gt;pag_num - 1  ) &gt; $forum_template-&gt;total_topic_count ) ? $forum_template-&gt;total_topic_count : $from_num + ( $forum_template-&gt;pag_num - 1 ) );
+                $total = bp_core_number_format( $forum_template-&gt;total_topic_count );
</ins><span class="cx"> 
</span><del>-        $pag_filter = false;
-        if ( 'tags' == $forum_template-&gt;type &amp;&amp; !empty( $forum_template-&gt;search_terms ) )
-                $pag_filter = sprintf( __( ' matching tag &quot;%s&quot;', 'buddypress' ), $forum_template-&gt;search_terms );
</del><ins>+                $pag_filter = false;
+                if ( 'tags' == $forum_template-&gt;type &amp;&amp; !empty( $forum_template-&gt;search_terms ) )
+                        $pag_filter = sprintf( __( ' matching tag &quot;%s&quot;', 'buddypress' ), $forum_template-&gt;search_terms );
</ins><span class="cx"> 
</span><del>-        echo apply_filters( 'bp_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (%s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
-?&gt;
-&lt;span class=&quot;ajax-loader&quot;&gt;&lt;/span&gt;
-&lt;?php
-}
</del><ins>+                return apply_filters( 'bp_get_forum_pagination_count', sprintf( __( 'Viewing topic %s to %s (of %s total topics%s)', 'buddypress' ), $from_num, $to_num, $total, $pag_filter ) );
+        }
</ins><span class="cx"> 
</span><span class="cx"> function bp_is_edit_topic() {
</span><span class="cx">         global $bp;
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-templatetags.php (2949 => 2950)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-templatetags.php        2010-04-21 13:13:15 UTC (rev 2949)
+++ trunk/bp-groups/bp-groups-templatetags.php        2010-04-24 15:34:25 UTC (rev 2950)
</span><span class="lines">@@ -19,9 +19,6 @@
</span><span class="cx"> 
</span><span class="cx">         var $single_group = false;
</span><span class="cx"> 
</span><del>-        var $sort_by;
-        var $order;
-
</del><span class="cx">         function bp_groups_template( $user_id, $type, $page, $per_page, $max, $slug, $search_terms, $include, $populate_extras ) {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="lines">@@ -64,7 +61,7 @@
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_links = paginate_links( array(
</span><del>-                        'base' =&gt; add_query_arg( array( 'grpage' =&gt; '%#%', 'num' =&gt; $this-&gt;pag_num, 's' =&gt; $search_terms, 'sortby' =&gt; $this-&gt;sort_by, 'order' =&gt; $this-&gt;order ) ),
</del><ins>+                        'base' =&gt; add_query_arg( array( 'grpage' =&gt; '%#%' ) ),
</ins><span class="cx">                         'format' =&gt; '',
</span><span class="cx">                         'total' =&gt; ceil($this-&gt;total_group_count / $this-&gt;pag_num),
</span><span class="cx">                         'current' =&gt; $this-&gt;pag_page,
</span><span class="lines">@@ -550,15 +547,17 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx"> function bp_groups_pagination_count() {
</span><del>-        global $bp, $groups_template;
</del><ins>+        echo bp_get_groups_pagination_count();
+}
+        function bp_get_groups_pagination_count() {
+                global $bp, $groups_template;
</ins><span class="cx"> 
</span><del>-        $from_num = bp_core_number_format( intval( ( $groups_template-&gt;pag_page - 1 ) * $groups_template-&gt;pag_num ) + 1 );
-        $to_num = bp_core_number_format( ( $from_num + ( $groups_template-&gt;pag_num - 1 ) &gt; $groups_template-&gt;total_group_count ) ? $groups_template-&gt;total_group_count : $from_num + ( $groups_template-&gt;pag_num - 1 ) );
-        $total = bp_core_number_format( $groups_template-&gt;total_group_count );
</del><ins>+                $from_num = bp_core_number_format( intval( ( $groups_template-&gt;pag_page - 1 ) * $groups_template-&gt;pag_num ) + 1 );
+                $to_num = bp_core_number_format( ( $from_num + ( $groups_template-&gt;pag_num - 1 ) &gt; $groups_template-&gt;total_group_count ) ? $groups_template-&gt;total_group_count : $from_num + ( $groups_template-&gt;pag_num - 1 ) );
+                $total = bp_core_number_format( $groups_template-&gt;total_group_count );
</ins><span class="cx"> 
</span><del>-        echo sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ); ?&gt; &amp;nbsp;
-        &lt;span class=&quot;ajax-loader&quot;&gt;&lt;/span&gt;&lt;?php
-}
</del><ins>+                return apply_filters( 'bp_get_groups_pagination_count', sprintf( __( 'Viewing group %1$s to %2$s (of %3$s groups)', 'buddypress' ), $from_num, $to_num, $total ) );
+        }
</ins><span class="cx"> 
</span><span class="cx"> function bp_group_total_members() {
</span><span class="cx">         echo bp_get_group_total_members();
</span></span></pre>
</div>
</div>

</body>
</html>