Index: /trunk/src/bp-groups/bp-groups-template.php
===================================================================
--- /trunk/src/bp-groups/bp-groups-template.php	(revision 9937)
+++ /trunk/src/bp-groups/bp-groups-template.php	(revision 9938)
@@ -256,6 +256,7 @@
 		$this->pag_num  = bp_sanitize_pagination_arg( 'num',          $r['per_page'] );
 
-		if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) )
+		if ( bp_current_user_can( 'bp_moderate' ) || ( is_user_logged_in() && $user_id == bp_loggedin_user_id() ) ) {
 			$show_hidden = true;
+		}
 
 		if ( 'invites' == $type ) {
@@ -378,6 +379,7 @@
 	 */
 	function has_groups() {
-		if ( $this->group_count )
+		if ( $this->group_count ) {
 			return true;
+		}
 
 		return false;
@@ -620,9 +622,11 @@
 	global $groups_template;
 
-	if ( bp_current_user_can( 'bp_moderate' ) )
+	if ( bp_current_user_can( 'bp_moderate' ) ) {
 		return true;
-
-	if ( empty( $group ) )
+	}
+
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	if ( 'public' == $group->status ) {
@@ -656,6 +660,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -764,6 +769,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -798,6 +804,7 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	if ( 'public' == $group->status ) {
@@ -840,6 +847,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1006,11 +1014,13 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		$last_active = $group->last_activity;
 
-		if ( !$last_active )
+		if ( !$last_active ) {
 			$last_active = groups_get_groupmeta( $group->id, 'last_activity' );
+		}
 
 		if ( empty( $last_active ) ) {
@@ -1083,6 +1093,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1116,6 +1127,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1149,6 +1161,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1186,6 +1199,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1264,6 +1278,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		if ( $group->is_public ) {
@@ -1298,6 +1313,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		return apply_filters( 'bp_get_group_is_public', $group->is_public );
@@ -1324,6 +1340,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1357,6 +1374,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1390,6 +1408,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1423,6 +1442,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1448,9 +1468,11 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( empty( $user_id ) )
+	}
+
+	if ( empty( $user_id ) ) {
 		$user_id = bp_loggedin_user_id();
+	}
 
 	return (bool) ( $group->creator_id == $user_id );
@@ -1491,6 +1513,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		$defaults = array(
@@ -1642,6 +1665,7 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	$admin_ids = array();
@@ -1653,6 +1677,7 @@
 	}
 
-	if ( 'string' == $format )
+	if ( 'string' == $format ) {
 		$admin_ids = implode( ',', $admin_ids );
+	}
 
 	/**
@@ -1682,6 +1707,7 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	$mod_ids = array();
@@ -1693,6 +1719,7 @@
 	}
 
-	if ( 'string' == $format )
+	if ( 'string' == $format ) {
 		$mod_ids = implode( ',', $mod_ids );
+	}
 
 	/**
@@ -1725,6 +1752,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1771,6 +1799,7 @@
  */
 function bp_group_show_no_groups_message() {
-	if ( !groups_total_groups_for_user( bp_displayed_user_id() ) )
+	if ( !groups_total_groups_for_user( bp_displayed_user_id() ) ) {
 		return true;
+	}
 
 	return false;
@@ -1788,6 +1817,7 @@
 function bp_group_is_activity_permalink() {
 
-	if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) )
+	if ( !bp_is_single_item() || !bp_is_groups_component() || !bp_is_current_action( bp_get_activity_slug() ) ) {
 		return false;
+	}
 
 	return true;
@@ -1895,6 +1925,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1957,6 +1988,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -1999,18 +2031,22 @@
 		extract( $r, EXTR_SKIP );
 
-		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
+		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) {
 			return false;
-
-		if ( !bp_is_active( 'forums' ) )
+		}
+
+		if ( !bp_is_active( 'forums' ) ) {
 			return false;
-
-		if ( !$groups_template->group->forum_counts )
+		}
+
+		if ( !$groups_template->group->forum_counts ) {
 			$groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
+		}
 
 		if ( (bool) $showtext ) {
-			if ( 1 == (int) $groups_template->group->forum_counts[0]->topics )
+			if ( 1 == (int) $groups_template->group->forum_counts[0]->topics ) {
 				$total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
-			else
+			} else {
 				$total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->topics );
+			}
 		} else {
 			$total_topics = (int) $groups_template->group->forum_counts[0]->topics;
@@ -2057,18 +2093,22 @@
 		extract( $r, EXTR_SKIP );
 
-		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) )
+		if ( !$forum_id = groups_get_groupmeta( $groups_template->group->id, 'forum_id' ) ) {
 			return false;
-
-		if ( !bp_is_active( 'forums' ) )
+		}
+
+		if ( !bp_is_active( 'forums' ) ) {
 			return false;
-
-		if ( !$groups_template->group->forum_counts )
+		}
+
+		if ( !$groups_template->group->forum_counts ) {
 			$groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int) $forum_id );
+		}
 
 		if ( (bool) $showtext ) {
-			if ( 1 == (int) $groups_template->group->forum_counts[0]->posts )
+			if ( 1 == (int) $groups_template->group->forum_counts[0]->posts ) {
 				$total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
-			else
+			} else {
 				$total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $groups_template->group->forum_counts[0]->posts );
+			}
 		} else {
 			$total_posts = (int) $groups_template->group->forum_counts[0]->posts;
@@ -2096,9 +2136,11 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( ! empty( $group->enable_forum ) )
+	}
+
+	if ( ! empty( $group->enable_forum ) ) {
 		return true;
+	}
 
 	return false;
@@ -2113,9 +2155,11 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( $group->enable_forum )
+	}
+
+	if ( $group->enable_forum ) {
 		echo ' checked="checked"';
+	}
 }
 
@@ -2129,9 +2173,11 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( $setting == $group->status )
+	}
+
+	if ( $setting == $group->status ) {
 		echo ' checked="checked"';
+	}
 }
 
@@ -2150,6 +2196,7 @@
 	$invite_status = bp_group_get_invite_status( $group_id );
 
-	if ( $setting == $invite_status )
+	if ( $setting == $invite_status ) {
 		echo ' checked="checked"';
+	}
 }
 
@@ -2296,6 +2343,7 @@
 	_deprecated_function( __FUNCTION__, '1.5', 'No longer used. See /bp-default/groups/single/admin.php' );
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 
@@ -2372,6 +2420,7 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	if ( $group_mods = groups_get_group_mods( $group->id ) ) { ?>
@@ -2441,6 +2490,7 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	/**
@@ -2541,6 +2591,7 @@
 	global $members_template;
 
-	if ( !$user_id )
+	if ( !$user_id ) {
 		$user_id = $members_template->member->user_id;
+	}
 
 	echo bp_get_group_member_demote_link( $user_id );
@@ -2558,9 +2609,11 @@
 		global $members_template, $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
-
-		if ( !$user_id )
+		}
+
+		if ( !$user_id ) {
 			$user_id = $members_template->member->user_id;
+		}
 
 		/**
@@ -2583,6 +2636,7 @@
 	global $members_template;
 
-	if ( !$user_id )
+	if ( !$user_id ) {
 		$user_id = $members_template->member->user_id;
+	}
 
 	echo bp_get_group_member_ban_link( $user_id );
@@ -2600,6 +2654,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -2622,6 +2677,7 @@
 	global $members_template;
 
-	if ( !$user_id )
+	if ( !$user_id ) {
 		$user_id = $members_template->member->user_id;
+	}
 
 	echo bp_get_group_member_unban_link( $user_id );
@@ -2639,9 +2695,11 @@
 		global $members_template, $groups_template;
 
-		if ( !$user_id )
+		if ( !$user_id ) {
 			$user_id = $members_template->member->user_id;
-
-		if ( empty( $group ) )
+		}
+
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -2664,6 +2722,7 @@
 	global $members_template;
 
-	if ( !$user_id )
+	if ( !$user_id ) {
 		$user_id = $members_template->member->user_id;
+	}
 
 	echo bp_get_group_member_remove_link( $user_id );
@@ -2681,6 +2740,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -2795,6 +2855,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -2828,9 +2889,11 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
-
-		if ( empty( $page ) )
+		}
+
+		if ( empty( $page ) ) {
 			$page = bp_action_variable( 0 );
+		}
 
 		/**
@@ -2855,9 +2918,11 @@
 	global $groups_template;
 
-	if ( empty( $group ) )
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) )
+	}
+
+	if ( groups_check_for_membership_request( bp_loggedin_user_id(), $group->id ) ) {
 		return true;
+	}
 
 	return false;
@@ -2878,9 +2943,11 @@
 
 	// Site admins always have access
-	if ( bp_current_user_can( 'bp_moderate' ) )
+	if ( bp_current_user_can( 'bp_moderate' ) ) {
 		return true;
-
-	if ( empty( $group ) )
+	}
+
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
+	}
 
 	/**
@@ -2999,6 +3066,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		$bp = buddypress();
@@ -3031,6 +3099,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		$bp = buddypress();
@@ -3063,6 +3132,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -3093,6 +3163,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -3123,6 +3194,7 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
+		}
 
 		/**
@@ -3147,12 +3219,15 @@
 	global $groups_template;
 
-	if ( !bp_is_active( 'friends' ) )
+	if ( !bp_is_active( 'friends' ) ) {
 		return false;
-
-	if ( empty( $group ) )
+	}
+
+	if ( empty( $group ) ) {
 		$group =& $groups_template->group;
-
-	if ( !friends_check_user_has_friends( bp_loggedin_user_id() ) || !friends_count_invitable_friends( bp_loggedin_user_id(), $group->id ) )
+	}
+
+	if ( !friends_check_user_has_friends( bp_loggedin_user_id() ) || !friends_count_invitable_friends( bp_loggedin_user_id(), $group->id ) ) {
 		return false;
+	}
 
 	return true;
@@ -3184,9 +3259,11 @@
 		global $groups_template;
 
-		if ( empty( $group ) )
+		if ( empty( $group ) ) {
 			$group =& $groups_template->group;
-
-		if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() )
+		}
+
+		if ( !is_user_logged_in() || bp_group_is_user_banned() || !bp_is_group_forum() || bp_is_group_forum_topic() ) {
 			return false;
+		}
 
 		$button = array(
