<!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->pag_page = isset( $_REQUEST['acpage'] ) ? intval( $_REQUEST['acpage'] ) : $page;
</span><del>-                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this->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->disable_blogforum_replies = $bp->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->my_favs = maybe_unserialize( get_usermeta( $bp->loggedin_user->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->activities = bp_activity_get_specific( array( 'activity_ids' => explode( ',', $include ), 'max' => $max, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'sort' => $sort, 'display_comments' => $display_comments ) );
</span><del>-                } else {
</del><ins>+                else
</ins><span class="cx">                         $this->activities = bp_activity_get( array( 'display_comments' => $display_comments, 'max' => $max, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'sort' => $sort, 'search_terms' => $search_terms, 'filter' => $filter, 'show_hidden' => $show_hidden ) );
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 if ( !$max || $max >= (int)$this->activities['total'] )
</span><span class="cx">                         $this->total_activity_count = (int)$this->activities['total'];
</span><span class="lines">@@ -42,19 +41,22 @@
</span><span class="cx">                 $this->activities = $this->activities['activities'];
</span><span class="cx">
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max >= count($this->activities) )
-                                $this->activity_count = count($this->activities);
-                        else
</del><ins>+                        if ( $max >= count($this->activities) ) {
+                                $this->activity_count = count( $this->activities );
+                        } else {
</ins><span class="cx">                                 $this->activity_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this->activity_count = count($this->activities);
</del><ins>+                        $this->activity_count = count( $this->activities );
</ins><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 $this->full_name = $bp->displayed_user->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->activities as $activity ) {
</span><del>-                        if ( 'activity_comment' != $activity->type ) continue;
</del><ins>+                        if ( 'activity_comment' != $activity->type )
+                                continue;
+
</ins><span class="cx">                         $parent_ids[] = $activity->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' => $parent_ids ) );
</span><span class="cx">
</span><span class="cx">                 if ( !empty( $activity_parents['activities'] ) ) {
</span><del>-                        foreach( $activity_parents['activities'] as $parent ) $this->activity_parents[$parent->id] = $parent;
</del><ins>+                        foreach( $activity_parents['activities'] as $parent )
+                                $this->activity_parents[$parent->id] = $parent;
+
</ins><span class="cx">                         unset( $activity_parents );
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( (int) $this->total_activity_count && (int) $this->pag_num ) {
</del><ins>+                if ( (int)$this->total_activity_count && (int)$this->pag_num ) {
</ins><span class="cx">                         $this->pag_links = paginate_links( array(
</span><del>-                                'base' => add_query_arg( 'acpage', '%#%' ),
-                                'format' => '',
-                                'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),
-                                'current' => (int)$this->pag_page,
</del><ins>+                                'base' => add_query_arg( 'acpage', '%#%' ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_activity_count / (int)$this->pag_num ),
+                                'current' => (int)$this->pag_page,
</ins><span class="cx">                                 'prev_text' => '&larr;',
</span><span class="cx">                                 'next_text' => '&rarr;',
</span><del>-                                'mid_size' => 1
-                        ));
</del><ins>+                                'mid_size' => 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->pag_page = isset( $_REQUEST['bpage'] ) ? intval( $_REQUEST['bpage'] ) : $page;
</span><del>-                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx">
</span><span class="cx">                 if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
</span><span class="cx">                         $this->blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page );
</span><span class="lines">@@ -36,23 +36,26 @@
</span><span class="cx">                 $this->blogs = $this->blogs['blogs'];
</span><span class="cx">
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max >= count($this->blogs) )
-                                $this->blog_count = count($this->blogs);
-                        else
</del><ins>+                        if ( $max >= count( $this->blogs ) ) {
+                                $this->blog_count = count( $this->blogs );
+                        } else {
</ins><span class="cx">                                 $this->blog_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this->blog_count = count($this->blogs);
</del><ins>+                        $this->blog_count = count( $this->blogs );
</ins><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->pag_links = paginate_links( array(
-                        'base' => add_query_arg( 'bpage', '%#%' ),
-                        'format' => '',
-                        'total' => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
-                        'current' => (int) $this->pag_page,
-                        'prev_text' => '&larr;',
-                        'next_text' => '&rarr;',
-                        'mid_size' => 1
-                ));
</del><ins>+                if ( (int)$this->total_blog_count && (int)$this->pag_num ) {
+                        $this->pag_links = paginate_links( array(
+                                'base' => add_query_arg( 'bpage', '%#%' ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_blog_count / (int)$this->pag_num ),
+                                'current' => (int)$this->pag_page,
+                                'prev_text' => '&larr;',
+                                'next_text' => '&rarr;',
+                                'mid_size' => 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->pag_page = isset( $_REQUEST['upage'] ) ? intval( $_REQUEST['upage'] ) : $page_number;
</span><del>-                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
-                $this->type = $type;
</del><ins>+                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
+                $this->type = $type;
</ins><span class="cx">
</span><del>-                if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) {
</del><ins>+                if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] )
</ins><span class="cx">                         $this->members = BP_Core_User::get_users_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page, $populate_extras );
</span><del>-                }
-                else if ( false !== $include ) {
</del><ins>+                else if ( false !== $include )
</ins><span class="cx">                         $this->members = BP_Core_User::get_specific_users( $include, $this->pag_num, $this->pag_page, $populate_extras );
</span><del>-                }
-                else {
</del><ins>+                else
</ins><span class="cx">                         $this->members = bp_core_get_users( array( 'type' => $this->type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
</span><del>-                }
</del><span class="cx">
</span><span class="cx">                 if ( !$max || $max >= (int)$this->members['total'] )
</span><span class="cx">                         $this->total_member_count = (int)$this->members['total'];
</span><span class="lines">@@ -42,24 +39,25 @@
</span><span class="cx">                 $this->members = $this->members['users'];
</span><span class="cx">
</span><span class="cx">                 if ( $max ) {
</span><del>-                        if ( $max >= count($this->members) )
-                                $this->member_count = count($this->members);
-                        else
</del><ins>+                        if ( $max >= count( $this->members ) ) {
+                                $this->member_count = count( $this->members );
+                        } else {
</ins><span class="cx">                                 $this->member_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">                 } else {
</span><del>-                        $this->member_count = count($this->members);
</del><ins>+                        $this->member_count = count( $this->members );
</ins><span class="cx">                 }
</span><span class="cx">
</span><del>-                if ( (int) $this->total_member_count && (int) $this->pag_num ) {
</del><ins>+                if ( (int)$this->total_member_count && (int)$this->pag_num ) {
</ins><span class="cx">                         $this->pag_links = paginate_links( array(
</span><del>-                                'base' => add_query_arg( 'upage', '%#%' ),
-                                'format' => '',
-                                'total' => ceil( (int) $this->total_member_count / (int) $this->pag_num ),
-                                'current' => (int) $this->pag_page,
</del><ins>+                                'base' => add_query_arg( 'upage', '%#%' ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_member_count / (int)$this->pag_num ),
+                                'current' => (int) $this->pag_page,
</ins><span class="cx">                                 'prev_text' => '&larr;',
</span><span class="cx">                                 'next_text' => '&rarr;',
</span><del>-                                'mid_size' => 1
-                        ));
</del><ins>+                                'mid_size' => 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->pag_page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;
-                $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
-                $this->type = $type;
</del><ins>+                $this->pag_page = isset( $_REQUEST['p'] ) ? intval( $_REQUEST['p'] ) : $page;
+                $this->pag_num = isset( $_REQUEST['n'] ) ? intval( $_REQUEST['n'] ) : $per_page;
+                $this->type = $type;
</ins><span class="cx">                 $this->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->total_topic_count = (int)$max;
</span><span class="cx">
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max >= count($this->topics) )
</del><ins>+                                if ( $max >= count( $this->topics ) ) {
</ins><span class="cx">                                         $this->topic_count = count( $this->topics );
</span><del>-                                else
</del><ins>+                                } else {
</ins><span class="cx">                                         $this->topic_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this->topic_count = count( $this->topics );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->topic_count = apply_filters( 'bp_forums_template_topic_count', $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</del><ins>+                $this->topic_count = apply_filters( 'bp_forums_template_topic_count', $this->topic_count, &$topics, $type, $forum_id, $per_page, $max, $no_stickies );
</ins><span class="cx">                 $this->total_topic_count = apply_filters( 'bp_forums_template_total_topic_count', $this->total_topic_count, $this->topic_count, &$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->topics as $topic ) {
</span><del>-                                if ( 1 == (int)$topic->topic_sticky )
</del><ins>+                                if ( 1 == (int)$topic->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->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->topics = bp_forums_get_topic_extras( &$this->topics );
</span><span class="cx">
</span><del>-                $this->pag_links = paginate_links( array(
-                        'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ),
-                        'format' => '',
-                        'total' => ceil($this->total_topic_count / $this->pag_num),
-                        'current' => $this->pag_page,
-                        'prev_text' => '&larr;',
-                        'next_text' => '&rarr;',
-                        'mid_size' => 1
-                ));
</del><ins>+                if ( (int)$this->total_topic_count && (int)$this->pag_num ) {
+                        $this->pag_links = paginate_links( array(
+                                'base' => add_query_arg( array( 'p' => '%#%', 'n' => $this->pag_num ) ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_topic_count / (int)$this->pag_num ),
+                                'current' => $this->pag_page,
+                                'prev_text' => '&larr;',
+                                'next_text' => '&rarr;',
+                                'mid_size' => 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->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
-                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this->pag_page = isset( $_REQUEST['topic_page'] ) ? intval( $_REQUEST['topic_page'] ) : 1;
+                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</ins><span class="cx">
</span><del>-                $this->topic_id = $topic_id;
</del><ins>+                $this->order = $order;
+                $this->topic_id = $topic_id;
</ins><span class="cx">                 $forum_template->topic = (object) bp_forums_get_topic_details( $this->topic_id );
</span><span class="cx">
</span><del>-                $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num ) );
</del><ins>+                $this->posts = bp_forums_get_topic_posts( array( 'topic_id' => $this->topic_id, 'page' => $this->pag_page, 'per_page' => $this->pag_num, 'order' => $this->order ) );
</ins><span class="cx">
</span><span class="cx">                 if ( !$this->posts ) {
</span><span class="cx">                         $this->post_count = 0;
</span><span class="cx">                         $this->total_post_count = 0;
</span><span class="cx">                 } else {
</span><del>-                        if ( !$max || $max >= (int) $forum_template->topic->topic_posts )
</del><ins>+                        if ( !$max || $max >= (int) $forum_template->topic->topic_posts ) {
</ins><span class="cx">                                 $this->total_post_count = (int) $forum_template->topic->topic_posts;
</span><del>-                        else
</del><ins>+                        } else {
</ins><span class="cx">                                 $this->total_post_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max >= count($this->posts) )
</del><ins>+                                if ( $max >= count( $this->posts ) ) {
</ins><span class="cx">                                         $this->post_count = count( $this->posts );
</span><del>-                                else
</del><ins>+                                } else {
</ins><span class="cx">                                         $this->post_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this->post_count = count( $this->posts );
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->pag_links = paginate_links( array(
-                        'base' => add_query_arg( array( 'topic_page' => '%#%', 'num' => $this->pag_num ) ),
-                        'format' => '',
-                        'total' => ceil($this->total_post_count / $this->pag_num),
-                        'current' => $this->pag_page,
-                        'prev_text' => '&larr;',
-                        'next_text' => '&rarr;',
-                        'mid_size' => 1
-                ));
-                $this->pag->total_pages = ceil($this->total_post_count / $this->pag_num);
</del><ins>+                if ( (int)$this->total_post_count && (int)$this->pag_num ) {
+                        $this->pag_links = paginate_links( array(
+                                'base' => add_query_arg( array( 'topic_page' => '%#%', 'num' => (int)$this->pag_num ) ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_post_count / (int)$this->pag_num ),
+                                'current' => $this->pag_page,
+                                'prev_text' => '&larr;',
+                                'next_text' => '&rarr;',
+                                'mid_size' => 1
+                        ) );
+
+                        $this->pag->total_pages = ceil( (int)$this->total_post_count / (int)$this->pag_num );
+                } else {
+                        $this->pag->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->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : $page;
</span><del>-                $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
</del><ins>+                $this->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->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->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->group_id = BP_Groups_Group::get_id_from_slug($slug);
</span><del>-                        $this->groups = array( $group );
-                } else
</del><ins>+                        $this->groups = array( $group );
+                } else {
</ins><span class="cx">                         $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' => $this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'include' => $include, 'populate_extras' => $populate_extras ) );
</span><ins>+                }
</ins><span class="cx">
</span><span class="cx">                 if ( 'invites' == $type ) {
</span><span class="cx">                         $this->total_group_count = (int)$this->groups['total'];
</span><del>-                        $this->group_count = (int)$this->groups['total'];
-                        $this->groups = $this->groups['groups'];
</del><ins>+                        $this->group_count = (int)$this->groups['total'];
+                        $this->groups = $this->groups['groups'];
</ins><span class="cx">                 } else if ( 'single-group' == $type ) {
</span><del>-                        $this->single_group = true;
</del><ins>+                        $this->single_group = true;
</ins><span class="cx">                         $this->total_group_count = 1;
</span><del>-                        $this->group_count = 1;
</del><ins>+                        $this->group_count = 1;
</ins><span class="cx">                 } else {
</span><del>-                        if ( !$max || $max >= (int)$this->groups['total'] )
</del><ins>+                        if ( !$max || $max >= (int)$this->groups['total'] ) {
</ins><span class="cx">                                 $this->total_group_count = (int)$this->groups['total'];
</span><del>-                        else
</del><ins>+                        } else {
</ins><span class="cx">                                 $this->total_group_count = (int)$max;
</span><ins>+                        }
</ins><span class="cx">
</span><span class="cx">                         $this->groups = $this->groups['groups'];
</span><span class="cx">
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max >= count($this->groups) )
-                                        $this->group_count = count($this->groups);
-                                else
</del><ins>+                                if ( $max >= count( $this->groups ) ) {
+                                        $this->group_count = count( $this->groups );
+                                } else {
</ins><span class="cx">                                         $this->group_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><del>-                                $this->group_count = count($this->groups);
</del><ins>+                                $this->group_count = count( $this->groups );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->pag_links = paginate_links( array(
-                        'base' => add_query_arg( array( 'grpage' => '%#%' ) ),
-                        'format' => '',
-                        'total' => ceil($this->total_group_count / $this->pag_num),
-                        'current' => $this->pag_page,
-                        'prev_text' => '&larr;',
-                        'next_text' => '&rarr;',
-                        'mid_size' => 1
-                ));
</del><ins>+                // Build pagination links
+                if ( (int)$this->total_group_count && (int)$this->pag_num ) {
+                        $this->pag_links = paginate_links( array(
+                                'base' => add_query_arg( array( 'grpage' => '%#%' ) ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_group_count / (int)$this->pag_num ),
+                                'current' => $this->pag_page,
+                                'prev_text' => '&larr;',
+                                'next_text' => '&rarr;',
+                                'mid_size' => 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->pag_page = isset( $_GET['mpage'] ) ? intval( $_GET['mpage'] ) : 1;
</span><del>-                $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
</del><ins>+                $this->pag_num = isset( $_GET['num'] ) ? intval( $_GET['num'] ) : $per_page;
</ins><span class="cx">
</span><del>-                $this->user_id = $user_id;
-                $this->box = $box;
-                $this->type = $type;
</del><ins>+                $this->user_id = $user_id;
+                $this->box = $box;
+                $this->type = $type;
</ins><span class="cx">
</span><span class="cx">                 if ( 'notices' == $this->box )
</span><span class="cx">                         $this->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->user_id, $this->box, $this->type, $this->pag_num, $this->pag_page );
</span><span class="cx">
</span><del>-                        $this->threads = $threads['threads'];
</del><ins>+                        $this->threads = $threads['threads'];
</ins><span class="cx">                         $this->total_thread_count = $threads['total'];
</span><span class="cx">                 }
</span><span class="cx">
</span><span class="cx">                 if ( !$this->threads ) {
</span><del>-                        $this->thread_count = 0;
</del><ins>+                        $this->thread_count = 0;
</ins><span class="cx">                         $this->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 >= (int)$total_notice_count ) {
</span><del>-                                if ( 'notices' == $this->box )
</del><ins>+                                if ( 'notices' == $this->box ) {
</ins><span class="cx">                                         $this->total_thread_count = (int)$total_notice_count;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><span class="cx">                                 $this->total_thread_count = (int)$max;
</span><span class="cx">                         }
</span><span class="cx">
</span><span class="cx">                         if ( $max ) {
</span><del>-                                if ( $max >= count($this->threads) )
-                                        $this->thread_count = count($this->threads);
-                                else
</del><ins>+                                if ( $max >= count( $this->threads ) ) {
+                                        $this->thread_count = count( $this->threads );
+                                } else {
</ins><span class="cx">                                         $this->thread_count = (int)$max;
</span><ins>+                                }
</ins><span class="cx">                         } else {
</span><del>-                                $this->thread_count = count($this->threads);
</del><ins>+                                $this->thread_count = count( $this->threads );
</ins><span class="cx">                         }
</span><span class="cx">                 }
</span><span class="cx">
</span><del>-                $this->pag_links = paginate_links( array(
-                        'base' => add_query_arg( 'mpage', '%#%' ),
-                        'format' => '',
-                        'total' => ceil($this->total_thread_count / $this->pag_num),
-                        'current' => $this->pag_page,
-                        'prev_text' => '&larr;',
-                        'next_text' => '&rarr;',
-                        'mid_size' => 1
-                ));
</del><ins>+                if ( (int)$this->total_thread_count && (int)$this->pag_num ) {
+                        $this->pag_links = paginate_links( array(
+                                'base' => add_query_arg( 'mpage', '%#%' ),
+                                'format' => '',
+                                'total' => ceil( (int)$this->total_thread_count / (int)$this->pag_num ),
+                                'current' => $this->pag_page,
+                                'prev_text' => '&larr;',
+                                'next_text' => '&rarr;',
+                                'mid_size' => 1
+                        ) );
+                }
</ins><span class="cx">         }
</span><span class="cx">
</span><span class="cx">         function has_threads() {
</span></span></pre>
</div>
</div>
</body>
</html>