<!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] [3247] trunk: Fixes #2625 (trunk)</title>
</head>
<body>

<div id="msg">
<dl>
<dt>Revision</dt> <dd>3247</dd>
<dt>Author</dt> <dd>johnjamesjacoby</dd>
<dt>Date</dt> <dd>2010-09-10 21:49:11 +0000 (Fri, 10 Sep 2010)</dd>
</dl>

<h3>Log Message</h3>
<pre>Fixes #2625 (trunk)</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkbpactivitybpactivitytemplatetagsphp">trunk/bp-activity/bp-activity-templatetags.php</a></li>
<li><a href="#trunkbpblogsbpblogstemplatetagsphp">trunk/bp-blogs/bp-blogs-templatetags.php</a></li>
<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>
<li><a href="#trunkbpmessagesbpmessagestemplatetagsphp">trunk/bp-messages/bp-messages-templatetags.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkbpactivitybpactivitytemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-activity/bp-activity-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-activity/bp-activity-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-activity/bp-activity-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -19,20 +19,19 @@
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['acpage'] ) ? intval( $_REQUEST['acpage'] ) : $page;
</span><del>-                $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this-&gt;pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx"> 
</span><del>-                /* Check if blog/forum replies are disabled */
</del><ins>+                // Check if blog/forum replies are disabled
</ins><span class="cx">                 $this-&gt;disable_blogforum_replies = $bp-&gt;site_options['bp-disable-blogforum-comments'];
</span><span class="cx"> 
</span><del>-                /* Get an array of the logged in user's favorite activities */
</del><ins>+                // Get an array of the logged in user's favorite activities
</ins><span class="cx">                 $this-&gt;my_favs = maybe_unserialize( get_usermeta( $bp-&gt;loggedin_user-&gt;id, 'bp_favorite_activities' ) );
</span><span class="cx"> 
</span><del>-                if ( !empty( $include ) ) {
-                        /* Fetch specific activity items based on ID's */
</del><ins>+                // Fetch specific activity items based on ID's
+                if ( !empty( $include ) )
</ins><span class="cx">                         $this-&gt;activities = bp_activity_get_specific( array( 'activity_ids' =&gt; explode( ',', $include ), 'max' =&gt; $max, 'page' =&gt; $this-&gt;pag_page, 'per_page' =&gt; $this-&gt;pag_num, 'sort' =&gt; $sort, 'display_comments' =&gt; $display_comments ) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $this-&gt;activities = bp_activity_get( array( 'display_comments' =&gt; $display_comments, 'max' =&gt; $max, 'per_page' =&gt; $this-&gt;pag_num, 'page' =&gt; $this-&gt;pag_page, 'sort' =&gt; $sort, 'search_terms' =&gt; $search_terms, 'filter' =&gt; $filter, 'show_hidden' =&gt; $show_hidden ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !$max || $max &gt;= (int)$this-&gt;activities['total'] )
</span><span class="cx">                         $this-&gt;total_activity_count = (int)$this-&gt;activities['total'];
</span><span class="lines">@@ -42,19 +41,22 @@
</span><span class="cx">                 $this-&gt;activities = $this-&gt;activities['activities'];
</span><span class="cx"> 
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max &gt;= count($this-&gt;activities) )
-                                $this-&gt;activity_count = count($this-&gt;activities);
-                        else
</del><ins>+                        if ( $max &gt;= count($this-&gt;activities) ) {
+                                $this-&gt;activity_count = count( $this-&gt;activities );
+                        } else {
</ins><span class="cx">                                 $this-&gt;activity_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this-&gt;activity_count = count($this-&gt;activities);
</del><ins>+                        $this-&gt;activity_count = count( $this-&gt;activities );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;full_name = $bp-&gt;displayed_user-&gt;fullname;
</span><span class="cx"> 
</span><del>-                /* Fetch parent content for activity comments so we do not have to query in the loop */
</del><ins>+                // Fetch parent content for activity comments so we do not have to query in the loop
</ins><span class="cx">                 foreach ( (array)$this-&gt;activities as $activity ) {
</span><del>-                        if ( 'activity_comment' != $activity-&gt;type ) continue;
</del><ins>+                        if ( 'activity_comment' != $activity-&gt;type )
+                                continue;
+
</ins><span class="cx">                         $parent_ids[] = $activity-&gt;item_id;
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="lines">@@ -62,20 +64,22 @@
</span><span class="cx">                         $activity_parents = bp_activity_get_specific( array( 'activity_ids' =&gt; $parent_ids ) );
</span><span class="cx"> 
</span><span class="cx">                 if ( !empty( $activity_parents['activities'] ) ) {
</span><del>-                        foreach( $activity_parents['activities'] as $parent ) $this-&gt;activity_parents[$parent-&gt;id] = $parent;
</del><ins>+                        foreach( $activity_parents['activities'] as $parent )
+                                $this-&gt;activity_parents[$parent-&gt;id] = $parent;
+
</ins><span class="cx">                         unset( $activity_parents );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( (int) $this-&gt;total_activity_count &amp;&amp; (int) $this-&gt;pag_num ) {
</del><ins>+                if ( (int)$this-&gt;total_activity_count &amp;&amp; (int)$this-&gt;pag_num ) {
</ins><span class="cx">                         $this-&gt;pag_links = paginate_links( array(
</span><del>-                                'base' =&gt; add_query_arg( 'acpage', '%#%' ),
-                                'format' =&gt; '',
-                                'total' =&gt; ceil( (int)$this-&gt;total_activity_count / (int)$this-&gt;pag_num ),
-                                'current' =&gt; (int)$this-&gt;pag_page,
</del><ins>+                                'base'      =&gt; add_query_arg( 'acpage', '%#%' ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_activity_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; (int)$this-&gt;pag_page,
</ins><span class="cx">                                 'prev_text' =&gt; '&amp;larr;',
</span><span class="cx">                                 'next_text' =&gt; '&amp;rarr;',
</span><del>-                                'mid_size' =&gt; 1
-                        ));
</del><ins>+                                'mid_size'  =&gt; 1
+                        ) );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpblogsbpblogstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-blogs/bp-blogs-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-blogs/bp-blogs-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-blogs/bp-blogs-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -21,7 +21,7 @@
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
</span><del>-                $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this-&gt;pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx"> 
</span><span class="cx">                 if ( isset( $_REQUEST['letter'] ) &amp;&amp; '' != $_REQUEST['letter'] )
</span><span class="cx">                         $this-&gt;blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this-&gt;pag_num, $this-&gt;pag_page );
</span><span class="lines">@@ -36,23 +36,26 @@
</span><span class="cx">                 $this-&gt;blogs = $this-&gt;blogs['blogs'];
</span><span class="cx"> 
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max &gt;= count($this-&gt;blogs) )
-                                $this-&gt;blog_count = count($this-&gt;blogs);
-                        else
</del><ins>+                        if ( $max &gt;= count( $this-&gt;blogs ) ) {
+                                $this-&gt;blog_count = count( $this-&gt;blogs );
+                        } else {
</ins><span class="cx">                                 $this-&gt;blog_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this-&gt;blog_count = count($this-&gt;blogs);
</del><ins>+                        $this-&gt;blog_count = count( $this-&gt;blogs );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_links = paginate_links( array(
-                        'base' =&gt; add_query_arg( 'bpage', '%#%' ),
-                        'format' =&gt; '',
-                        'total' =&gt; ceil( (int) $this-&gt;total_blog_count / (int) $this-&gt;pag_num ),
-                        'current' =&gt; (int) $this-&gt;pag_page,
-                        'prev_text' =&gt; '&amp;larr;',
-                        'next_text' =&gt; '&amp;rarr;',
-                        'mid_size' =&gt; 1
-                ));
</del><ins>+                if ( (int)$this-&gt;total_blog_count &amp;&amp; (int)$this-&gt;pag_num ) {
+                        $this-&gt;pag_links = paginate_links( array(
+                                'base'      =&gt; add_query_arg( 'bpage', '%#%' ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_blog_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; (int)$this-&gt;pag_page,
+                                'prev_text' =&gt; '&amp;larr;',
+                                'next_text' =&gt; '&amp;rarr;',
+                                'mid_size'  =&gt; 1
+                        ) );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_blogs() {
</span></span></pre></div>
<a id="trunkbpcorebpcoretemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-core/bp-core-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-core/bp-core-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-core/bp-core-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -21,18 +21,15 @@
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
</span><del>-                $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
-                $this-&gt;type = $type;
</del><ins>+                $this-&gt;pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+                $this-&gt;type     = $type;
</ins><span class="cx"> 
</span><del>-                if ( isset( $_REQUEST['letter'] ) &amp;&amp; '' != $_REQUEST['letter'] ) {
</del><ins>+                if ( isset( $_REQUEST['letter'] ) &amp;&amp; '' != $_REQUEST['letter'] )
</ins><span class="cx">                         $this-&gt;members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this-&gt;pag_num, $this-&gt;pag_page, $populate_extras );
</span><del>-                }
-                else if ( false !== $include ) {
</del><ins>+                else if ( false !== $include )
</ins><span class="cx">                         $this-&gt;members = BP_Core_User::get_specific_users( $include, $this-&gt;pag_num, $this-&gt;pag_page, $populate_extras );
</span><del>-                }
-                else {
</del><ins>+                else
</ins><span class="cx">                         $this-&gt;members = bp_core_get_users( array( 'type' =&gt; $this-&gt;type, 'per_page' =&gt; $this-&gt;pag_num, 'page' =&gt; $this-&gt;pag_page, 'user_id' =&gt; $user_id, 'search_terms' =&gt; $search_terms, 'populate_extras' =&gt; $populate_extras ) );
</span><del>-                }
</del><span class="cx"> 
</span><span class="cx">                 if ( !$max || $max &gt;= (int)$this-&gt;members['total'] )
</span><span class="cx">                         $this-&gt;total_member_count = (int)$this-&gt;members['total'];
</span><span class="lines">@@ -42,24 +39,25 @@
</span><span class="cx">                 $this-&gt;members = $this-&gt;members['users'];
</span><span class="cx"> 
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max &gt;= count($this-&gt;members) )
-                                $this-&gt;member_count = count($this-&gt;members);
-                        else
</del><ins>+                        if ( $max &gt;= count( $this-&gt;members ) ) {
+                                $this-&gt;member_count = count( $this-&gt;members );
+                        } else {
</ins><span class="cx">                                 $this-&gt;member_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this-&gt;member_count = count($this-&gt;members);
</del><ins>+                        $this-&gt;member_count = count( $this-&gt;members );
</ins><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                if ( (int) $this-&gt;total_member_count &amp;&amp; (int) $this-&gt;pag_num ) {
</del><ins>+                if ( (int)$this-&gt;total_member_count &amp;&amp; (int)$this-&gt;pag_num ) {
</ins><span class="cx">                         $this-&gt;pag_links = paginate_links( array(
</span><del>-                                'base' =&gt; add_query_arg( 'upage', '%#%' ),
-                                'format' =&gt; '',
-                                'total' =&gt; ceil( (int) $this-&gt;total_member_count / (int) $this-&gt;pag_num ),
-                                'current' =&gt; (int) $this-&gt;pag_page,
</del><ins>+                                'base'      =&gt; add_query_arg( 'upage', '%#%' ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_member_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; (int) $this-&gt;pag_page,
</ins><span class="cx">                                 'prev_text' =&gt; '&amp;larr;',
</span><span class="cx">                                 'next_text' =&gt; '&amp;rarr;',
</span><del>-                                'mid_size' =&gt; 1
-                        ));
</del><ins>+                                'mid_size'   =&gt; 1
+                        ) );
</ins><span class="cx">                 }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkbpforumsbpforumstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-forums/bp-forums-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-forums/bp-forums-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-forums/bp-forums-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -21,9 +21,9 @@
</span><span class="cx">         function BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms ) {
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;
-                $this-&gt;pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
-                $this-&gt;type = $type;
</del><ins>+                $this-&gt;pag_page     = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;
+                $this-&gt;pag_num      = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
+                $this-&gt;type         = $type;
</ins><span class="cx">                 $this-&gt;search_terms = $search_terms;
</span><span class="cx"> 
</span><span class="cx">                 switch ( $type ) {
</span><span class="lines">@@ -65,41 +65,46 @@
</span><span class="cx">                                 $this-&gt;total_topic_count = (int)$max;
</span><span class="cx"> 
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max &gt;= count($this-&gt;topics) )
</del><ins>+                                if ( $max &gt;= count( $this-&gt;topics ) ) {
</ins><span class="cx">                                         $this-&gt;topic_count = count( $this-&gt;topics );
</span><del>-                                else
</del><ins>+                                } else {
</ins><span class="cx">                                         $this-&gt;topic_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this-&gt;topic_count = count( $this-&gt;topics );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;topic_count = apply_filters( 'bp_forums_template_topic_count', $this-&gt;topic_count, &amp;$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</del><ins>+                $this-&gt;topic_count       = apply_filters( 'bp_forums_template_topic_count', $this-&gt;topic_count, &amp;$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</ins><span class="cx">                 $this-&gt;total_topic_count = apply_filters( 'bp_forums_template_total_topic_count', $this-&gt;total_topic_count, $this-&gt;topic_count, &amp;$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</span><span class="cx"> 
</span><del>-                if ( !$no_stickies) {
-                        /* Place stickies at the top - not sure why bbPress doesn't do this? */
</del><ins>+                if ( !$no_stickies ) {
+                        // Place stickies at the top - not sure why bbPress doesn't do this?
</ins><span class="cx">                         foreach( (array)$this-&gt;topics as $topic ) {
</span><del>-                                if ( 1 == (int)$topic-&gt;topic_sticky )
</del><ins>+                                if ( 1 == (int)$topic-&gt;topic_sticky ) {
</ins><span class="cx">                                         $stickies[] = $topic;
</span><del>-                                else
</del><ins>+                                } else {
</ins><span class="cx">                                         $standard[] = $topic;
</span><ins>+                                }
</ins><span class="cx">                         }
</span><ins>+
</ins><span class="cx">                         $this-&gt;topics = array_merge( (array)$stickies, (array)$standard );
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                /* Fetch extra information for topics, so we don't have to query inside the loop */
</del><ins>+                // Fetch extra information for topics, so we don't have to query inside the loop
</ins><span class="cx">                 $this-&gt;topics = bp_forums_get_topic_extras( &amp;$this-&gt;topics );
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_links = paginate_links( array(
-                        'base' =&gt; add_query_arg( array( 'p' =&gt; '%#%', 'n' =&gt; $this-&gt;pag_num ) ),
-                        'format' =&gt; '',
-                        'total' =&gt; ceil($this-&gt;total_topic_count / $this-&gt;pag_num),
-                        'current' =&gt; $this-&gt;pag_page,
-                        'prev_text' =&gt; '&amp;larr;',
-                        'next_text' =&gt; '&amp;rarr;',
-                        'mid_size' =&gt; 1
-                ));
</del><ins>+                if ( (int)$this-&gt;total_topic_count &amp;&amp; (int)$this-&gt;pag_num ) {
+                        $this-&gt;pag_links = paginate_links( array(
+                                'base'      =&gt; add_query_arg( array( 'p' =&gt; '%#%', 'n' =&gt; $this-&gt;pag_num ) ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_topic_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; $this-&gt;pag_page,
+                                'prev_text' =&gt; '&amp;larr;',
+                                'next_text' =&gt; '&amp;rarr;',
+                                'mid_size'  =&gt; 1
+                        ) );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_topics() {
</span><span class="lines">@@ -709,43 +714,51 @@
</span><span class="cx">         function BP_Forums_Template_Topic( $topic_id, $per_page, $max ) {
</span><span class="cx">                 global $bp, $current_user, $forum_template;
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
-                $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this-&gt;pag_page        = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
+                $this-&gt;pag_num         = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx"> 
</span><del>-                $this-&gt;topic_id = $topic_id;
</del><ins>+                $this-&gt;order           = $order;
+                $this-&gt;topic_id        = $topic_id;
</ins><span class="cx">                 $forum_template-&gt;topic = (object) bp_forums_get_topic_details( $this-&gt;topic_id );
</span><span class="cx"> 
</span><del>-                $this-&gt;posts = bp_forums_get_topic_posts( array( 'topic_id' =&gt; $this-&gt;topic_id, 'page' =&gt; $this-&gt;pag_page, 'per_page' =&gt; $this-&gt;pag_num ) );
</del><ins>+                $this-&gt;posts           = bp_forums_get_topic_posts( array( 'topic_id' =&gt; $this-&gt;topic_id, 'page' =&gt; $this-&gt;pag_page, 'per_page' =&gt; $this-&gt;pag_num, 'order' =&gt; $this-&gt;order ) );
</ins><span class="cx"> 
</span><span class="cx">                 if ( !$this-&gt;posts ) {
</span><span class="cx">                         $this-&gt;post_count = 0;
</span><span class="cx">                         $this-&gt;total_post_count = 0;
</span><span class="cx">                 } else {
</span><del>-                        if ( !$max || $max &gt;= (int) $forum_template-&gt;topic-&gt;topic_posts )
</del><ins>+                        if ( !$max || $max &gt;= (int) $forum_template-&gt;topic-&gt;topic_posts ) {
</ins><span class="cx">                                 $this-&gt;total_post_count = (int) $forum_template-&gt;topic-&gt;topic_posts;
</span><del>-                        else
</del><ins>+                        } else {
</ins><span class="cx">                                 $this-&gt;total_post_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx"> 
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max &gt;= count($this-&gt;posts) )
</del><ins>+                                if ( $max &gt;= count( $this-&gt;posts ) ) {
</ins><span class="cx">                                         $this-&gt;post_count = count( $this-&gt;posts );
</span><del>-                                else
</del><ins>+                                } else {
</ins><span class="cx">                                         $this-&gt;post_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this-&gt;post_count = count( $this-&gt;posts );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_links = paginate_links( array(
-                        'base' =&gt; add_query_arg( array( 'topic_page' =&gt; '%#%', 'num' =&gt; $this-&gt;pag_num ) ),
-                        'format' =&gt; '',
-                        'total' =&gt; ceil($this-&gt;total_post_count / $this-&gt;pag_num),
-                        'current' =&gt; $this-&gt;pag_page,
-                        'prev_text' =&gt; '&amp;larr;',
-                        'next_text' =&gt; '&amp;rarr;',
-                        'mid_size' =&gt; 1
-                ));
-                $this-&gt;pag-&gt;total_pages = ceil($this-&gt;total_post_count / $this-&gt;pag_num);
</del><ins>+                if ( (int)$this-&gt;total_post_count &amp;&amp; (int)$this-&gt;pag_num ) {
+                        $this-&gt;pag_links = paginate_links( array(
+                                'base'      =&gt; add_query_arg( array( 'topic_page' =&gt; '%#%', 'num' =&gt; (int)$this-&gt;pag_num ) ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_post_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; $this-&gt;pag_page,
+                                'prev_text' =&gt; '&amp;larr;',
+                                'next_text' =&gt; '&amp;rarr;',
+                                'mid_size'  =&gt; 1
+                        ) );
+
+                        $this-&gt;pag-&gt;total_pages = ceil( (int)$this-&gt;total_post_count / (int)$this-&gt;pag_num );
+                } else {
+                        $this-&gt;pag-&gt;total_pages = 1;
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_posts() {
</span></span></pre></div>
<a id="trunkbpgroupsbpgroupstemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-groups/bp-groups-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-groups/bp-groups-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-groups/bp-groups-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -23,52 +23,58 @@
</span><span class="cx">                 global $bp;
</span><span class="cx"> 
</span><span class="cx">                 $this-&gt;pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
</span><del>-                $this-&gt;pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this-&gt;pag_num  = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx"> 
</span><del>-                if ( 'invites' == $type )
</del><ins>+                if ( 'invites' == $type ) {
</ins><span class="cx">                         $this-&gt;groups = groups_get_invites_for_user( $user_id, $this-&gt;pag_num, $this-&gt;pag_page );
</span><del>-                else if ( 'single-group' == $type ) {
</del><ins>+                } else if ( 'single-group' == $type ) {
</ins><span class="cx">                         $group = new stdClass;
</span><span class="cx">                         $group-&gt;group_id = BP_Groups_Group::get_id_from_slug($slug);
</span><del>-                        $this-&gt;groups = array( $group );
-                } else
</del><ins>+                        $this-&gt;groups    = array( $group );
+                } else {
</ins><span class="cx">                         $this-&gt;groups = groups_get_groups( array( 'type' =&gt; $type, 'per_page' =&gt; $this-&gt;pag_num, 'page' =&gt; $this-&gt;pag_page, 'user_id' =&gt; $user_id, 'search_terms' =&gt; $search_terms, 'include' =&gt; $include, 'populate_extras' =&gt; $populate_extras ) );
</span><ins>+                }
</ins><span class="cx"> 
</span><span class="cx">                 if ( 'invites' == $type ) {
</span><span class="cx">                         $this-&gt;total_group_count = (int)$this-&gt;groups['total'];
</span><del>-                        $this-&gt;group_count = (int)$this-&gt;groups['total'];
-                        $this-&gt;groups = $this-&gt;groups['groups'];
</del><ins>+                        $this-&gt;group_count       = (int)$this-&gt;groups['total'];
+                        $this-&gt;groups            = $this-&gt;groups['groups'];
</ins><span class="cx">                 } else if ( 'single-group' == $type ) {
</span><del>-                        $this-&gt;single_group = true;
</del><ins>+                        $this-&gt;single_group      = true;
</ins><span class="cx">                         $this-&gt;total_group_count = 1;
</span><del>-                        $this-&gt;group_count = 1;
</del><ins>+                        $this-&gt;group_count       = 1;
</ins><span class="cx">                 } else {
</span><del>-                        if ( !$max || $max &gt;= (int)$this-&gt;groups['total'] )
</del><ins>+                        if ( !$max || $max &gt;= (int)$this-&gt;groups['total'] ) {
</ins><span class="cx">                                 $this-&gt;total_group_count = (int)$this-&gt;groups['total'];
</span><del>-                        else
</del><ins>+                        } else {
</ins><span class="cx">                                 $this-&gt;total_group_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx"> 
</span><span class="cx">                         $this-&gt;groups = $this-&gt;groups['groups'];
</span><span class="cx"> 
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max &gt;= count($this-&gt;groups) )
-                                        $this-&gt;group_count = count($this-&gt;groups);
-                                else
</del><ins>+                                if ( $max &gt;= count( $this-&gt;groups ) ) {
+                                        $this-&gt;group_count = count( $this-&gt;groups );
+                                } else {
</ins><span class="cx">                                         $this-&gt;group_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><del>-                                $this-&gt;group_count = count($this-&gt;groups);
</del><ins>+                                $this-&gt;group_count = count( $this-&gt;groups );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_links = paginate_links( array(
-                        'base' =&gt; add_query_arg( array( 'grpage' =&gt; '%#%' ) ),
-                        'format' =&gt; '',
-                        'total' =&gt; ceil($this-&gt;total_group_count / $this-&gt;pag_num),
-                        'current' =&gt; $this-&gt;pag_page,
-                        'prev_text' =&gt; '&amp;larr;',
-                        'next_text' =&gt; '&amp;rarr;',
-                        'mid_size' =&gt; 1
-                ));
</del><ins>+                // Build pagination links
+                if ( (int)$this-&gt;total_group_count &amp;&amp; (int)$this-&gt;pag_num ) {
+                        $this-&gt;pag_links = paginate_links( array(
+                                'base'      =&gt; add_query_arg( array( 'grpage' =&gt; '%#%' ) ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_group_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; $this-&gt;pag_page,
+                                'prev_text' =&gt; '&amp;larr;',
+                                'next_text' =&gt; '&amp;rarr;',
+                                'mid_size'  =&gt; 1
+                        ) );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_groups() {
</span></span></pre></div>
<a id="trunkbpmessagesbpmessagestemplatetagsphp"></a>
<div class="modfile"><h4>Modified: trunk/bp-messages/bp-messages-templatetags.php (3246 => 3247)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/bp-messages/bp-messages-templatetags.php        2010-09-10 21:37:41 UTC (rev 3246)
+++ trunk/bp-messages/bp-messages-templatetags.php        2010-09-10 21:49:11 UTC (rev 3247)
</span><span class="lines">@@ -21,53 +21,57 @@
</span><span class="cx"> 
</span><span class="cx">         function bp_messages_box_template( $user_id, $box, $per_page, $max, $type ) {
</span><span class="cx">                 $this-&gt;pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
</span><del>-                $this-&gt;pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
</del><ins>+                $this-&gt;pag_num  = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
</ins><span class="cx"> 
</span><del>-                $this-&gt;user_id = $user_id;
-                $this-&gt;box = $box;
-                $this-&gt;type = $type;
</del><ins>+                $this-&gt;user_id  = $user_id;
+                $this-&gt;box      = $box;
+                $this-&gt;type     = $type;
</ins><span class="cx"> 
</span><span class="cx">                 if ( 'notices' == $this-&gt;box )
</span><span class="cx">                         $this-&gt;threads = BP_Messages_Notice::get_notices();
</span><span class="cx">                 else {
</span><span class="cx">                         $threads = BP_Messages_Thread::get_current_threads_for_user( $this-&gt;user_id, $this-&gt;box, $this-&gt;type, $this-&gt;pag_num, $this-&gt;pag_page );
</span><span class="cx"> 
</span><del>-                        $this-&gt;threads = $threads['threads'];
</del><ins>+                        $this-&gt;threads            = $threads['threads'];
</ins><span class="cx">                         $this-&gt;total_thread_count = $threads['total'];
</span><span class="cx">                 }
</span><span class="cx"> 
</span><span class="cx">                 if ( !$this-&gt;threads ) {
</span><del>-                        $this-&gt;thread_count = 0;
</del><ins>+                        $this-&gt;thread_count       = 0;
</ins><span class="cx">                         $this-&gt;total_thread_count = 0;
</span><span class="cx">                 } else {
</span><span class="cx">                         $total_notice_count = BP_Messages_Notice::get_total_notice_count();
</span><span class="cx"> 
</span><span class="cx">                         if ( !$max || $max &gt;= (int)$total_notice_count ) {
</span><del>-                                if ( 'notices' == $this-&gt;box )
</del><ins>+                                if ( 'notices' == $this-&gt;box ) {
</ins><span class="cx">                                         $this-&gt;total_thread_count = (int)$total_notice_count;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this-&gt;total_thread_count = (int)$max;
</span><span class="cx">                         }
</span><span class="cx"> 
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max &gt;= count($this-&gt;threads) )
-                                        $this-&gt;thread_count = count($this-&gt;threads);
-                                else
</del><ins>+                                if ( $max &gt;= count( $this-&gt;threads ) ) {
+                                        $this-&gt;thread_count = count( $this-&gt;threads );
+                                } else {
</ins><span class="cx">                                         $this-&gt;thread_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><del>-                                $this-&gt;thread_count = count($this-&gt;threads);
</del><ins>+                                $this-&gt;thread_count = count( $this-&gt;threads );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-                $this-&gt;pag_links = paginate_links( array(
-                        'base' =&gt; add_query_arg( 'mpage', '%#%' ),
-                        'format' =&gt; '',
-                        'total' =&gt; ceil($this-&gt;total_thread_count / $this-&gt;pag_num),
-                        'current' =&gt; $this-&gt;pag_page,
-                        'prev_text' =&gt; '&amp;larr;',
-                        'next_text' =&gt; '&amp;rarr;',
-                        'mid_size' =&gt; 1
-                ));
</del><ins>+                if ( (int)$this-&gt;total_thread_count &amp;&amp; (int)$this-&gt;pag_num ) {
+                        $this-&gt;pag_links = paginate_links( array(
+                                'base'      =&gt; add_query_arg( 'mpage', '%#%' ),
+                                'format'    =&gt; '',
+                                'total'     =&gt; ceil( (int)$this-&gt;total_thread_count / (int)$this-&gt;pag_num ),
+                                'current'   =&gt; $this-&gt;pag_page,
+                                'prev_text' =&gt; '&amp;larr;',
+                                'next_text' =&gt; '&amp;rarr;',
+                                'mid_size'  =&gt; 1
+                        ) );
+                }
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         function has_threads() {
</span></span></pre>
</div>
</div>

</body>
</html>