From 845a286f61538bb6a2cc80a81b52323cac591532 Mon Sep 17 00:00:00 2001
From: Varun Dubey <vapvarun@gmail.com>
Date: Tue, 10 Jul 2018 11:33:19 +0530
Subject: [PATCH] Group Default Check

---
 .../buddypress/groups/single/admin/group-settings.php          | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php b/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php
index 6a02a2179..7e9f046d2 100644
--- a/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php
+++ b/src/bp-templates/bp-nouveau/buddypress/groups/single/admin/group-settings.php
@@ -68,10 +68,16 @@
 
 		<p tabindex="0"><?php esc_html_e( 'Select the types this group should be a part of.', 'buddypress' ); ?></p>
 
-		<?php foreach ( $group_types as $type ) : ?>
+		<?php foreach ( $group_types as $type ) :
+			if ( bp_is_group_create() ) {
+							$checked = checked( true, ! empty( $type->create_screen_checked ), false );
+						} else {
+							$checked = checked( bp_groups_has_group_type( bp_get_current_group_id(), $type->name ), true, false );
+						}
+			?>
 			<div class="checkbox">
 				<label for="<?php printf( 'group-type-%s', $type->name ); ?>">
-					<input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php echo esc_attr( $type->name ); ?>" <?php checked( bp_groups_has_group_type( bp_get_current_group_id(), $type->name ) ); ?>/> <?php echo esc_html( $type->labels['name'] ); ?>
+					<input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php echo esc_attr( $type->name ); ?>" <?php echo $checked; ?>/> <?php echo esc_html( $type->labels['name'] ); ?>
 					<?php
 					if ( ! empty( $type->description ) ) {
 						printf( '&ndash; %s', '<span class="bp-group-type-desc">' . esc_html( $type->description ) . '</span>' );
