diff --git src/bp-activity/bp-activity-functions.php src/bp-activity/bp-activity-functions.php
index 3c8abff..d272dc4 100644
--- src/bp-activity/bp-activity-functions.php
+++ src/bp-activity/bp-activity-functions.php
@@ -3583,3 +3583,45 @@ function bp_activity_do_heartbeat() {
 
 	return $retval;
 }
+/**
+ * Get the arguments for the public message button.
+ *
+ * @since ?
+ *
+ * @param array|string $args {
+ *    All arguments are optional. See {@link BP_Button} for complete
+ *    descriptions.
+ *    @type string $id                Default: 'public_message'.
+ *    @type string $component         Default: 'activity'.
+ *    @type bool   $must_be_logged_in Default: true.
+ *    @type bool   $block_self        Default: true.
+ *    @type string $wrapper_id        Default: 'post-mention'.
+ *    @type string $link_href         Default: the public message link for
+ *                                    the current member in the loop.
+ *    @type string $link_title        Default: 'Send a public message on your
+ *                                    activity stream.'.
+ *    @type string $link_text         Default: 'Public Message'.
+ *    @type string $link_class        Default: 'activity-button mention'.
+ * }
+ * @return array The arguments for the public message button.
+ */
+function bp_activity_get_public_message_button_args( $args = '' ) {
+	/**
+	 * Filters the public message button HTML.
+	 *
+	 * @since 1.2.10
+	 *
+	 * @param array $value Array of arguments for the public message button HTML.
+	 */
+	return apply_filters( 'bp_get_send_public_message_button', bp_parse_args( $args, array(
+		'id'                => 'public_message',
+		'component'         => 'activity',
+		'must_be_logged_in' => true,
+		'block_self'        => true,
+		'wrapper_id'        => 'post-mention',
+		'link_href'         => bp_get_send_public_message_link(),
+		'link_title'        => __( 'Send a public message on your activity stream.', 'buddypress' ),
+		'link_text'         => __( 'Public Message', 'buddypress' ),
+		'link_class'        => 'activity-button mention'
+	) ) );
+}
diff --git src/bp-activity/bp-activity-template.php src/bp-activity/bp-activity-template.php
index 810b76e..7fb3c34 100644
--- src/bp-activity/bp-activity-template.php
+++ src/bp-activity/bp-activity-template.php
@@ -3145,9 +3145,9 @@ function bp_mentioned_user_display_name( $user_id_or_username = false ) {
  *
  * @since 1.2.0
  *
- * @see bp_get_send_public_message_button() for description of parameters.
+ * @see bp_activity_get_public_message_button_args() for description of parameters.
  *
- * @param array|string $args See {@link bp_get_send_public_message_button()}.
+ * @param array|string $args See {@link bp_activity_get_public_message_button_args()}.
  */
 function bp_send_public_message_button( $args = '' ) {
 	echo bp_get_send_public_message_button( $args );
@@ -3158,46 +3158,18 @@ function bp_send_public_message_button( $args = '' ) {
 	 *
 	 * @since 1.2.0
 	 *
-	 *
-	 * @param array|string $args {
-	 *     All arguments are optional. See {@link BP_Button} for complete
-	 *     descriptions.
-	 *     @type string $id                Default: 'public_message'.
-	 *     @type string $component         Default: 'activity'.
-	 *     @type bool   $must_be_logged_in Default: true.
-	 *     @type bool   $block_self        Default: true.
-	 *     @type string $wrapper_id        Default: 'post-mention'.
-	 *     @type string $link_href         Default: the public message link for
-	 *                                     the current member in the loop.
-	 *     @type string $link_title        Default: 'Send a public message on your
-	 *                                     activity stream.'.
-	 *     @type string $link_text         Default: 'Public Message'.
-	 *     @type string $link_class        Default: 'activity-button mention'.
-	 * }
+	 * @param array|string $args See {@link bp_activity_get_public_message_button_args()}.
 	 * @return string The button for sending a public message.
 	 */
 	function bp_get_send_public_message_button( $args = '' ) {
 
-		$r = bp_parse_args( $args, array(
-			'id'                => 'public_message',
-			'component'         => 'activity',
-			'must_be_logged_in' => true,
-			'block_self'        => true,
-			'wrapper_id'        => 'post-mention',
-			'link_href'         => bp_get_send_public_message_link(),
-			'link_title'        => __( 'Send a public message on your activity stream.', 'buddypress' ),
-			'link_text'         => __( 'Public Message', 'buddypress' ),
-			'link_class'        => 'activity-button mention'
-		) );
+		$button = bp_activity_get_public_message_button_args( $args );
 
-		/**
-		 * Filters the public message button HTML.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param array $r Array of arguments for the public message button HTML.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_send_public_message_button', $r ) );
+		if ( ! $button ) {
+			return false;
+		}
+
+		return bp_get_button( $button );
 	}
 
 /**
diff --git src/bp-blogs/bp-blogs-functions.php src/bp-blogs/bp-blogs-functions.php
index 595c305..abf0111 100644
--- src/bp-blogs/bp-blogs-functions.php
+++ src/bp-blogs/bp-blogs-functions.php
@@ -1349,3 +1349,74 @@ function bp_blogs_restore_data( $user_id = 0 ) {
 	}
 }
 add_action( 'bp_make_ham_user', 'bp_blogs_restore_data', 10, 1 );
+
+/**
+ * Get the arguments for the create a site button.
+ *
+ * @since ?
+ *
+ * @return array Array of arguments to be used for the Create a Site button.
+ */
+function bp_blogs_get_create_button_args() {
+	/**
+	 * Filters the Create a Site button.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $value Array of arguments to be used for the Create a Site button.
+	 */
+	return apply_filters( 'bp_get_blog_create_button', array(
+		'id'         => 'create_blog',
+		'component'  => 'blogs',
+		'link_text'  => __( 'Create a Site', 'buddypress' ),
+		'link_title' => __( 'Create a Site', 'buddypress' ),
+		'link_class' => 'blog-create no-ajax',
+		'link_href'  => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),
+		'wrapper'    => false,
+		'block_self' => false,
+	) );
+}
+
+/**
+ * Return the arguments of the button for visiting a blog in a loop.
+ *
+ * @see BP_Button for a complete description of arguments and return
+ *      value.
+ *
+ * @since ?
+ *
+ * @param array|string $args {
+ *     Arguments are listed below, with their default values. For a
+ *     complete description of arguments, see {@link BP_Button}.
+ *     @type string $id                Default: 'visit_blog'.
+ *     @type string $component         Default: 'blogs'.
+ *     @type bool   $must_be_logged_in Default: false.
+ *     @type bool   $block_self        Default: false.
+ *     @type string $wrapper_class     Default: 'blog-button visit'.
+ *     @type string $link_href         Permalink of the current blog in the loop.
+ *     @type string $link_class        Default: 'blog-button visit'.
+ *     @type string $link_text         Default: 'Visit Site'.
+ *     @type string $link_title        Default: 'Visit Site'.
+ * }
+ * @return array Thhe arguments of the button for visiting a blog in a loop.
+ */
+function bp_blogs_get_visit_button_args( $args = '' ) {
+	/**
+	 * Filters the button for visiting a blog in a loop.
+	 *
+	 * @since 1.2.10
+	 *
+	 * @param array $value Array of arguments to be used for the button to visit a blog.
+	 */
+	return apply_filters( 'bp_get_blogs_visit_blog_button', wp_parse_args( $args, array(
+		'id'                => 'visit_blog',
+		'component'         => 'blogs',
+		'must_be_logged_in' => false,
+		'block_self'        => false,
+		'wrapper_class'     => 'blog-button visit',
+		'link_href'         => bp_get_blog_permalink(),
+		'link_class'        => 'blog-button visit',
+		'link_text'         => __( 'Visit Site', 'buddypress' ),
+		'link_title'        => __( 'Visit Site', 'buddypress' ),
+	) ) );
+}
diff --git src/bp-blogs/bp-blogs-template.php src/bp-blogs/bp-blogs-template.php
index 312056f..57e867f 100644
--- src/bp-blogs/bp-blogs-template.php
+++ src/bp-blogs/bp-blogs-template.php
@@ -1276,25 +1276,13 @@ function bp_blog_create_button() {
 			return false;
 		}
 
-		$button_args = array(
-			'id'         => 'create_blog',
-			'component'  => 'blogs',
-			'link_text'  => __( 'Create a Site', 'buddypress' ),
-			'link_title' => __( 'Create a Site', 'buddypress' ),
-			'link_class' => 'blog-create no-ajax',
-			'link_href'  => trailingslashit( bp_get_blogs_directory_permalink() . 'create' ),
-			'wrapper'    => false,
-			'block_self' => false,
-		);
+		$button_args = bp_blogs_get_create_button_args();
 
-		/**
-		 * Filters the Create a Site button.
-		 *
-		 * @since 2.0.0
-		 *
-		 * @param array $button_args Array of arguments to be used for the Create a Site button.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_blog_create_button', $button_args ) );
+		if ( ! $button_args ) {
+			return false;
+		}
+
+		return bp_get_button( $button_args );
 	}
 
 /**
@@ -1353,9 +1341,9 @@ add_action( 'bp_blogs_directory_blog_types', 'bp_blog_backcompat_create_nav_item
 /**
  * Output button for visiting a blog in a loop.
  *
- * @see bp_get_blogs_visit_blog_button() for description of arguments.
+ * @see bp_blogs_get_visit_button_args() for description of arguments.
  *
- * @param array|string $args See {@link bp_get_blogs_visit_blog_button()}.
+ * @param array|string $args See {@link bp_blogs_get_visit_button_args()}.
  */
 function bp_blogs_visit_blog_button( $args = '' ) {
 	echo bp_get_blogs_visit_blog_button( $args );
@@ -1366,44 +1354,17 @@ function bp_blogs_visit_blog_button( $args = '' ) {
 	 * @see BP_Button for a complete description of arguments and return
 	 *      value.
 	 *
-	 * @param array|string $args {
-	 *     Arguments are listed below, with their default values. For a
-	 *     complete description of arguments, see {@link BP_Button}.
-	 *     @type string $id                Default: 'visit_blog'.
-	 *     @type string $component         Default: 'blogs'.
-	 *     @type bool   $must_be_logged_in Default: false.
-	 *     @type bool   $block_self        Default: false.
-	 *     @type string $wrapper_class     Default: 'blog-button visit'.
-	 *     @type string $link_href         Permalink of the current blog in the loop.
-	 *     @type string $link_class        Default: 'blog-button visit'.
-	 *     @type string $link_text         Default: 'Visit Site'.
-	 *     @type string $link_title        Default: 'Visit Site'.
-	 * }
+	 * @param array|string $args See {@link bp_blogs_get_visit_button_args()}
 	 * @return string The HTML for the Visit button.
 	 */
 	function bp_get_blogs_visit_blog_button( $args = '' ) {
-		$defaults = array(
-			'id'                => 'visit_blog',
-			'component'         => 'blogs',
-			'must_be_logged_in' => false,
-			'block_self'        => false,
-			'wrapper_class'     => 'blog-button visit',
-			'link_href'         => bp_get_blog_permalink(),
-			'link_class'        => 'blog-button visit',
-			'link_text'         => __( 'Visit Site', 'buddypress' ),
-			'link_title'        => __( 'Visit Site', 'buddypress' ),
-		);
-
-		$button = wp_parse_args( $args, $defaults );
+		$button = bp_blogs_get_visit_button_args( $args );
 
-		/**
-		 * Filters the button for visiting a blog in a loop.
-		 *
-		 * @since 1.2.10
-		 *
-		 * @param array $button Array of arguments to be used for the button to visit a blog.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_blogs_visit_blog_button', $button ) );
+		if ( ! $button ) {
+			return false;
+		}
+
+		return bp_get_button( $button );
 	}
 
 /** Stats **********************************************************************/
diff --git src/bp-friends/bp-friends-functions.php src/bp-friends/bp-friends-functions.php
index d9de4cb..95013c1 100644
--- src/bp-friends/bp-friends-functions.php
+++ src/bp-friends/bp-friends-functions.php
@@ -795,3 +795,106 @@ function bp_friends_prime_mentions_results() {
 	) );
 }
 add_action( 'bp_activity_mentions_prime_results', 'bp_friends_prime_mentions_results' );
+
+/**
+ * Get the arguments for the add friend button
+ *
+ * @since ?
+ *
+ * @param  int  $potential_friend_id ID of the user to whom the button applies.
+ *                                   Default: value of {@link bp_get_potential_friend_id()}.
+ * @param  bool $friend_status       Not currently used.
+ * @return array The button arguments.
+ */
+function bp_friends_get_add_friend_button_args( $potential_friend_id = 0, $friend_status = false ) {
+	$button = array();
+
+	if ( empty( $potential_friend_id ) ) {
+		$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
+	}
+
+	$is_friend = bp_is_friend( $potential_friend_id );
+
+	if ( empty( $is_friend ) ) {
+		return $button;
+	}
+
+	switch ( $is_friend ) {
+		case 'pending' :
+			$button = array(
+				'id'                => 'pending',
+				'component'         => 'friends',
+				'must_be_logged_in' => true,
+				'block_self'        => true,
+				'wrapper_class'     => 'friendship-button pending_friend',
+				'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+				'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ),
+				'link_text'         => __( 'Cancel Friendship Request', 'buddypress' ),
+				'link_title'        => __( 'Cancel Friendship Requested', 'buddypress' ),
+				'link_id'           => 'friend-' . $potential_friend_id,
+				'link_rel'          => 'remove',
+				'link_class'        => 'friendship-button pending_friend requested'
+			);
+			break;
+
+		case 'awaiting_response' :
+			$button = array(
+				'id'                => 'awaiting_response',
+				'component'         => 'friends',
+				'must_be_logged_in' => true,
+				'block_self'        => true,
+				'wrapper_class'     => 'friendship-button awaiting_response_friend',
+				'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+				'link_href'         => bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/',
+				'link_text'         => __( 'Friendship Requested', 'buddypress' ),
+				'link_title'        => __( 'Friendship Requested', 'buddypress' ),
+				'link_id'           => 'friend-' . $potential_friend_id,
+				'link_rel'          => 'remove',
+				'link_class'        => 'friendship-button awaiting_response_friend requested'
+			);
+			break;
+
+		case 'is_friend' :
+			$button = array(
+				'id'                => 'is_friend',
+				'component'         => 'friends',
+				'must_be_logged_in' => true,
+				'block_self'        => false,
+				'wrapper_class'     => 'friendship-button is_friend',
+				'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+				'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ),
+				'link_text'         => __( 'Cancel Friendship', 'buddypress' ),
+				'link_title'        => __( 'Cancel Friendship', 'buddypress' ),
+				'link_id'           => 'friend-' . $potential_friend_id,
+				'link_rel'          => 'remove',
+				'link_class'        => 'friendship-button is_friend remove'
+			);
+			break;
+
+		default:
+			$button = array(
+				'id'                => 'not_friends',
+				'component'         => 'friends',
+				'must_be_logged_in' => true,
+				'block_self'        => true,
+				'wrapper_class'     => 'friendship-button not_friends',
+				'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
+				'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ),
+				'link_text'         => __( 'Add Friend', 'buddypress' ),
+				'link_title'        => __( 'Add Friend', 'buddypress' ),
+				'link_id'           => 'friend-' . $potential_friend_id,
+				'link_rel'          => 'add',
+				'link_class'        => 'friendship-button not_friends add'
+			);
+			break;
+	}
+
+	/**
+	 * Filters the HTML for the add friend button.
+	 *
+	 * @since 1.1.0
+	 *
+	 * @param string $button HTML markup for add friend button.
+	 */
+	return apply_filters( 'bp_get_add_friend_button', $button );
+}
diff --git src/bp-friends/bp-friends-template.php src/bp-friends/bp-friends-template.php
index d3cc442..abffa4f 100644
--- src/bp-friends/bp-friends-template.php
+++ src/bp-friends/bp-friends-template.php
@@ -349,93 +349,13 @@ function bp_add_friend_button( $potential_friend_id = 0, $friend_status = false
 	 * @return string HTML for the Add Friend button.
 	 */
 	function bp_get_add_friend_button( $potential_friend_id = 0, $friend_status = false ) {
+		$button = bp_friends_get_add_friend_button_args( $potential_friend_id, $friend_status );
 
-		if ( empty( $potential_friend_id ) )
-			$potential_friend_id = bp_get_potential_friend_id( $potential_friend_id );
-
-		$is_friend = bp_is_friend( $potential_friend_id );
-
-		if ( empty( $is_friend ) )
+		if ( ! $button ) {
 			return false;
-
-		switch ( $is_friend ) {
-			case 'pending' :
-				$button = array(
-					'id'                => 'pending',
-					'component'         => 'friends',
-					'must_be_logged_in' => true,
-					'block_self'        => true,
-					'wrapper_class'     => 'friendship-button pending_friend',
-					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
-					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/cancel/' . $potential_friend_id . '/', 'friends_withdraw_friendship' ),
-					'link_text'         => __( 'Cancel Friendship Request', 'buddypress' ),
-					'link_title'        => __( 'Cancel Friendship Requested', 'buddypress' ),
-					'link_id'           => 'friend-' . $potential_friend_id,
-					'link_rel'          => 'remove',
-					'link_class'        => 'friendship-button pending_friend requested'
-				);
-				break;
-
-			case 'awaiting_response' :
-				$button = array(
-					'id'                => 'awaiting_response',
-					'component'         => 'friends',
-					'must_be_logged_in' => true,
-					'block_self'        => true,
-					'wrapper_class'     => 'friendship-button awaiting_response_friend',
-					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
-					'link_href'         => bp_loggedin_user_domain() . bp_get_friends_slug() . '/requests/',
-					'link_text'         => __( 'Friendship Requested', 'buddypress' ),
-					'link_title'        => __( 'Friendship Requested', 'buddypress' ),
-					'link_id'           => 'friend-' . $potential_friend_id,
-					'link_rel'          => 'remove',
-					'link_class'        => 'friendship-button awaiting_response_friend requested'
-				);
-				break;
-
-			case 'is_friend' :
-				$button = array(
-					'id'                => 'is_friend',
-					'component'         => 'friends',
-					'must_be_logged_in' => true,
-					'block_self'        => false,
-					'wrapper_class'     => 'friendship-button is_friend',
-					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
-					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/remove-friend/' . $potential_friend_id . '/', 'friends_remove_friend' ),
-					'link_text'         => __( 'Cancel Friendship', 'buddypress' ),
-					'link_title'        => __( 'Cancel Friendship', 'buddypress' ),
-					'link_id'           => 'friend-' . $potential_friend_id,
-					'link_rel'          => 'remove',
-					'link_class'        => 'friendship-button is_friend remove'
-				);
-				break;
-
-			default:
-				$button = array(
-					'id'                => 'not_friends',
-					'component'         => 'friends',
-					'must_be_logged_in' => true,
-					'block_self'        => true,
-					'wrapper_class'     => 'friendship-button not_friends',
-					'wrapper_id'        => 'friendship-button-' . $potential_friend_id,
-					'link_href'         => wp_nonce_url( bp_loggedin_user_domain() . bp_get_friends_slug() . '/add-friend/' . $potential_friend_id . '/', 'friends_add_friend' ),
-					'link_text'         => __( 'Add Friend', 'buddypress' ),
-					'link_title'        => __( 'Add Friend', 'buddypress' ),
-					'link_id'           => 'friend-' . $potential_friend_id,
-					'link_rel'          => 'add',
-					'link_class'        => 'friendship-button not_friends add'
-				);
-				break;
 		}
 
-		/**
-		 * Filters the HTML for the add friend button.
-		 *
-		 * @since 1.1.0
-		 *
-		 * @param string $button HTML markup for add friend button.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_add_friend_button', $button ) );
+		return bp_get_button( $button );
 	}
 
 /**
diff --git src/bp-groups/bp-groups-functions.php src/bp-groups/bp-groups-functions.php
index cb0753e..78f40c2 100644
--- src/bp-groups/bp-groups-functions.php
+++ src/bp-groups/bp-groups-functions.php
@@ -2393,3 +2393,168 @@ function bp_remove_group_type_on_group_delete( $group_id = 0 ) {
 	bp_groups_set_group_type( $group_id, '' );
 }
 add_action( 'groups_delete_group', 'bp_remove_group_type_on_group_delete' );
+
+/**
+ * Get the arguments for the Join button group
+ *
+ * @since ?
+ *
+ * @param BP_Groups_Group $group The group object.
+ * @return Array The arguments for the Join button group
+ */
+function bp_groups_get_group_join_button_args( $group = null ) {
+	$button = array();
+
+	if ( empty( $group->id ) ) {
+		return $button;
+	}
+
+	// Don't show button if not logged in or previously banned.
+	if ( ! is_user_logged_in() || bp_group_is_user_banned( $group ) ) {
+		return $button;
+	}
+
+	// Group creation was not completed or status is unknown.
+	if ( empty( $group->status ) ) {
+		return $button;
+	}
+
+	// Already a member.
+	if ( ! empty( $group->is_member ) ) {
+
+		// Stop sole admins from abandoning their group.
+		$group_admins = groups_get_group_admins( $group->id );
+		if ( ( 1 == count( $group_admins ) ) && ( bp_loggedin_user_id() === (int) $group_admins[0]->user_id ) ) {
+			return false;
+		}
+
+		// Setup button attributes.
+		$button = array(
+			'id'                => 'leave_group',
+			'component'         => 'groups',
+			'must_be_logged_in' => true,
+			'block_self'        => false,
+			'wrapper_class'     => 'group-button ' . $group->status,
+			'wrapper_id'        => 'groupbutton-' . $group->id,
+			'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ),
+			'link_text'         => __( 'Leave Group', 'buddypress' ),
+			'link_title'        => __( 'Leave Group', 'buddypress' ),
+			'link_class'        => 'group-button leave-group',
+		);
+
+	// Not a member.
+	} else {
+
+		// Show different buttons based on group status.
+		switch ( $group->status ) {
+			case 'hidden' :
+				return false;
+
+			case 'public':
+				$button = array(
+					'id'                => 'join_group',
+					'component'         => 'groups',
+					'must_be_logged_in' => true,
+					'block_self'        => false,
+					'wrapper_class'     => 'group-button ' . $group->status,
+					'wrapper_id'        => 'groupbutton-' . $group->id,
+					'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ),
+					'link_text'         => __( 'Join Group', 'buddypress' ),
+					'link_title'        => __( 'Join Group', 'buddypress' ),
+					'link_class'        => 'group-button join-group',
+				);
+				break;
+
+			case 'private' :
+
+				// Member has outstanding invitation -
+				// show an "Accept Invitation" button.
+				if ( $group->is_invited ) {
+					$button = array(
+						'id'                => 'accept_invite',
+						'component'         => 'groups',
+						'must_be_logged_in' => true,
+						'block_self'        => false,
+						'wrapper_class'     => 'group-button ' . $group->status,
+						'wrapper_id'        => 'groupbutton-' . $group->id,
+						'link_href'         => add_query_arg( 'redirect_to', bp_get_group_permalink( $group ), bp_get_group_accept_invite_link( $group ) ),
+						'link_text'         => __( 'Accept Invitation', 'buddypress' ),
+						'link_title'        => __( 'Accept Invitation', 'buddypress' ),
+						'link_class'        => 'group-button accept-invite',
+					);
+
+				// Member has requested membership but request is pending -
+				// show a "Request Sent" button.
+				} elseif ( $group->is_pending ) {
+					$button = array(
+						'id'                => 'membership_requested',
+						'component'         => 'groups',
+						'must_be_logged_in' => true,
+						'block_self'        => false,
+						'wrapper_class'     => 'group-button pending ' . $group->status,
+						'wrapper_id'        => 'groupbutton-' . $group->id,
+						'link_href'         => bp_get_group_permalink( $group ),
+						'link_text'         => __( 'Request Sent', 'buddypress' ),
+						'link_title'        => __( 'Request Sent', 'buddypress' ),
+						'link_class'        => 'group-button pending membership-requested',
+					);
+
+				// Member has not requested membership yet -
+				// show a "Request Membership" button.
+				} else {
+					$button = array(
+						'id'                => 'request_membership',
+						'component'         => 'groups',
+						'must_be_logged_in' => true,
+						'block_self'        => false,
+						'wrapper_class'     => 'group-button ' . $group->status,
+						'wrapper_id'        => 'groupbutton-' . $group->id,
+						'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ),
+						'link_text'         => __( 'Request Membership', 'buddypress' ),
+						'link_title'        => __( 'Request Membership', 'buddypress' ),
+						'link_class'        => 'group-button request-membership',
+					);
+				}
+
+				break;
+		}
+	}
+
+	/**
+	 * Filters the arguments of the button for joining a group.
+	 *
+	 * @since 1.2.6
+	 * @since 2.4.0 Added $group parameter to filter args.
+	 *
+	 * @param array  $button The arguments for the button.
+	 * @param object $group BuddyPress group object
+	 */
+	return apply_filters( 'bp_get_group_join_button', $button, $group );
+}
+
+/**
+ * Get the arguments for the Create a group button.
+ *
+ * @since ?
+ *
+ * @return Array The arguments for the Create a group button.
+ */
+function bp_groups_get_create_group_button_args() {
+	/**
+	 * Filters the arguments of the button for creating a group.
+	 *
+	 * @since 2.0.0
+	 *
+	 * @param array $value The arguments of the button for creating a group.
+	 */
+	return apply_filters( 'bp_get_group_create_button', array(
+		'id'         => 'create_group',
+		'component'  => 'groups',
+		'link_text'  => __( 'Create a Group', 'buddypress' ),
+		'link_title' => __( 'Create a Group', 'buddypress' ),
+		'link_class' => 'group-create no-ajax',
+		'link_href'  => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
+		'wrapper'    => false,
+		'block_self' => false,
+	) );
+}
diff --git src/bp-groups/bp-groups-template.php src/bp-groups/bp-groups-template.php
index be28ded..898d88b 100644
--- src/bp-groups/bp-groups-template.php
+++ src/bp-groups/bp-groups-template.php
@@ -3203,127 +3203,13 @@ function bp_group_join_button( $group = false ) {
 			$group =& $groups_template->group;
 		}
 
-		// Don't show button if not logged in or previously banned.
-		if ( ! is_user_logged_in() || bp_group_is_user_banned( $group ) ) {
-			return false;
-		}
+		$button_args = bp_groups_get_group_join_button_args( $group );
 
-		// Group creation was not completed or status is unknown.
-		if ( empty( $group->status ) ) {
+		if ( ! $button_args ) {
 			return false;
 		}
 
-		// Already a member.
-		if ( ! empty( $group->is_member ) ) {
-
-			// Stop sole admins from abandoning their group.
-			$group_admins = groups_get_group_admins( $group->id );
-			if ( ( 1 == count( $group_admins ) ) && ( bp_loggedin_user_id() === (int) $group_admins[0]->user_id ) ) {
-				return false;
-			}
-
-			// Setup button attributes.
-			$button = array(
-				'id'                => 'leave_group',
-				'component'         => 'groups',
-				'must_be_logged_in' => true,
-				'block_self'        => false,
-				'wrapper_class'     => 'group-button ' . $group->status,
-				'wrapper_id'        => 'groupbutton-' . $group->id,
-				'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'leave-group', 'groups_leave_group' ),
-				'link_text'         => __( 'Leave Group', 'buddypress' ),
-				'link_title'        => __( 'Leave Group', 'buddypress' ),
-				'link_class'        => 'group-button leave-group',
-			);
-
-		// Not a member.
-		} else {
-
-			// Show different buttons based on group status.
-			switch ( $group->status ) {
-				case 'hidden' :
-					return false;
-
-				case 'public':
-					$button = array(
-						'id'                => 'join_group',
-						'component'         => 'groups',
-						'must_be_logged_in' => true,
-						'block_self'        => false,
-						'wrapper_class'     => 'group-button ' . $group->status,
-						'wrapper_id'        => 'groupbutton-' . $group->id,
-						'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'join', 'groups_join_group' ),
-						'link_text'         => __( 'Join Group', 'buddypress' ),
-						'link_title'        => __( 'Join Group', 'buddypress' ),
-						'link_class'        => 'group-button join-group',
-					);
-					break;
-
-				case 'private' :
-
-					// Member has outstanding invitation -
-					// show an "Accept Invitation" button.
-					if ( $group->is_invited ) {
-						$button = array(
-							'id'                => 'accept_invite',
-							'component'         => 'groups',
-							'must_be_logged_in' => true,
-							'block_self'        => false,
-							'wrapper_class'     => 'group-button ' . $group->status,
-							'wrapper_id'        => 'groupbutton-' . $group->id,
-							'link_href'         => add_query_arg( 'redirect_to', bp_get_group_permalink( $group ), bp_get_group_accept_invite_link( $group ) ),
-							'link_text'         => __( 'Accept Invitation', 'buddypress' ),
-							'link_title'        => __( 'Accept Invitation', 'buddypress' ),
-							'link_class'        => 'group-button accept-invite',
-						);
-
-					// Member has requested membership but request is pending -
-					// show a "Request Sent" button.
-					} elseif ( $group->is_pending ) {
-						$button = array(
-							'id'                => 'membership_requested',
-							'component'         => 'groups',
-							'must_be_logged_in' => true,
-							'block_self'        => false,
-							'wrapper_class'     => 'group-button pending ' . $group->status,
-							'wrapper_id'        => 'groupbutton-' . $group->id,
-							'link_href'         => bp_get_group_permalink( $group ),
-							'link_text'         => __( 'Request Sent', 'buddypress' ),
-							'link_title'        => __( 'Request Sent', 'buddypress' ),
-							'link_class'        => 'group-button pending membership-requested',
-						);
-
-					// Member has not requested membership yet -
-					// show a "Request Membership" button.
-					} else {
-						$button = array(
-							'id'                => 'request_membership',
-							'component'         => 'groups',
-							'must_be_logged_in' => true,
-							'block_self'        => false,
-							'wrapper_class'     => 'group-button ' . $group->status,
-							'wrapper_id'        => 'groupbutton-' . $group->id,
-							'link_href'         => wp_nonce_url( bp_get_group_permalink( $group ) . 'request-membership', 'groups_request_membership' ),
-							'link_text'         => __( 'Request Membership', 'buddypress' ),
-							'link_title'        => __( 'Request Membership', 'buddypress' ),
-							'link_class'        => 'group-button request-membership',
-						);
-					}
-
-					break;
-			}
-		}
-
-		/**
-		 * Filters the HTML button for joining a group.
-		 *
-		 * @since 1.2.6
-		 * @since 2.4.0 Added $group parameter to filter args.
-		 *
-		 * @param string $button HTML button for joining a group.
-		 * @param object $group BuddyPress group object
-		 */
-		return bp_get_button( apply_filters( 'bp_get_group_join_button', $button, $group ) );
+		return bp_get_button( $button_args );
 	}
 
 /**
@@ -3350,25 +3236,13 @@ function bp_group_create_button() {
 			return false;
 		}
 
-		$button_args = array(
-			'id'         => 'create_group',
-			'component'  => 'groups',
-			'link_text'  => __( 'Create a Group', 'buddypress' ),
-			'link_title' => __( 'Create a Group', 'buddypress' ),
-			'link_class' => 'group-create no-ajax',
-			'link_href'  => trailingslashit( bp_get_groups_directory_permalink() . 'create' ),
-			'wrapper'    => false,
-			'block_self' => false,
-		);
+		$button_args = bp_groups_get_create_group_button_args();
 
-		/**
-		 * Filters the HTML button for creating a group.
-		 *
-		 * @since 2.0.0
-		 *
-		 * @param string $button HTML button for creating a group.
-		 */
-		return bp_get_button( apply_filters( 'bp_get_group_create_button', $button_args ) );
+		if ( ! $button_args ) {
+			return false;
+		}
+
+		return bp_get_button(  $button_args );
 	}
 
 /**
