Index: bp-forums/bp-forums-template.php
===================================================================
--- bp-forums/bp-forums-template.php	(revision 4204)
+++ bp-forums/bp-forums-template.php	(working copy)
@@ -130,22 +130,6 @@
 		$this->topic_count       = apply_filters_ref_array( 'bp_forums_template_topic_count',                                 array( $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
 		$this->total_topic_count = apply_filters_ref_array( 'bp_forums_template_total_topic_count', array( $this->total_topic_count, $this->topic_count, &$this->topics, $type, $forum_id, $per_page, $max, $no_stickies ) );
 
-		if ( !$no_stickies ) {
-			$stickies = array();
-			$standard = array();
-
-			// Place stickies at the top - not sure why bbPress doesn't do this?
-			foreach( (array)$this->topics as $topic ) {
-				if ( isset( $topic->topic_sticky ) && 1 == (int)$topic->topic_sticky ) {
-					$stickies[] = $topic;
-				} else {
-					$standard[] = $topic;
-				}
-			}
-
-			$this->topics = array_merge( (array)$stickies, (array)$standard );
-		}
-
 		// Fetch extra information for topics, so we don't have to query inside the loop
 		$this->topics = bp_forums_get_topic_extras( $this->topics );
 
@@ -220,7 +204,6 @@
 	$user_id      = 0;
 	$forum_id     = false;
 	$search_terms = false;
-	$no_stickies  = 'all';
 
 	// User filtering
 	if ( !empty( $bp->displayed_user->id ) )
@@ -242,10 +225,6 @@
 	if ( bp_is_directory() && !empty( $_GET['fs'] ) )
 		$search_terms = $_GET['fs'];
 
-	// Show stickies on a group forum
-	if ( isset( $bp->groups->current_group ) )
-		$no_stickies = null;
-
 	$defaults = array(
 		'type'         => $type,
 		'forum_id'     => $forum_id,
@@ -253,7 +232,6 @@
 		'page'         => 1,
 		'per_page'     => 20,
 		'max'          => false,
-		'no_stickies'  => $no_stickies,
 		'search_terms' => $search_terms
 	);
 
@@ -267,7 +245,35 @@
 		$type = 'tags';
 	}
 
-	$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, $no_stickies, $search_terms );
+	// Fetch the stickies
+	$forum_stickies = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, 0, 0, $max, 'sticky', $search_terms );
+	// Try merging the stickies
+	if ( $forum_stickies->has_topics() ) {
+		// If stickies are for current $page
+		$page_start_num = ( $page - 1 ) * $per_page;
+		$page_end_num = $page * $per_page;
+		if ( $forum_stickies->topic_count > $page_start_num && $forum_stickies->topic_count < $page_end_num ) {
+			// Fetch the non-sticky topics
+			$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'normal', $search_terms );
+			// Get the exact number of normal topics to complement the $per_page size
+			$forum_template->topics = array_slice( $forum_template->topics, 0, $per_page - $forum_stickies->topic_count );
+			// Slice the stickies array for current page size
+			$forum_stickies->topics = array_slice( $forum_stickies->topics, $page_start_num, $page_end_num );
+			// Merge the two, reverse stickies first, than pop on top of the normals
+			foreach ( array_reverse( $forum_stickies->topics ) as $sticky )
+				array_unshift( $forum_template->topics, $sticky );
+		} else {
+			// Recalculate the $per_page excluding the stickies
+			$per_page -= $forum_stickies->topic_count;
+			// Fetch the non-sticky topics
+			$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'normal', $search_terms );
+			// Recalculate the new index of topics
+			$forum_template->pag_num += $forum_stickies->topic_count;
+		}
+	} else
+		// Fetch the non-sticky topics if no stickies were found
+		$forum_template = new BP_Forums_Template_Forum( $type, $forum_id, $user_id, $page, $per_page, $max, 'normal', $search_terms );
+		
 	return apply_filters( 'bp_has_topics', $forum_template->has_topics(), $forum_template );
 }
 
@@ -1263,4 +1269,4 @@
 	function bp_get_forum_topic_count( $user_id = 0 ) {
 		return apply_filters( 'bp_get_forum_topic_count', bp_forums_total_topic_count( $user_id ) );
 	}
-?>
\ No newline at end of file
+?>
