Changeset 11176 for trunk/src/bp-groups/bp-groups-admin.php
- Timestamp:
- 10/06/2016 07:55:32 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-admin.php
r11139 r11176 1047 1047 } 1048 1048 1049 $types = bp_groups_get_group_types( array(), 'objects' ); 1050 $current_type = bp_groups_get_group_type( $group->id ); 1049 $types = bp_groups_get_group_types( array(), 'objects' ); 1050 $current_types = bp_groups_get_group_type( $group->id, false ); 1051 $backend_only = bp_groups_get_group_types( array( 'show_in_create_screen' => false ) ); 1051 1052 ?> 1052 1053 … … 1055 1056 esc_html_e( 'Select group type', 'buddypress' ); 1056 1057 ?></label> 1057 <select name="bp-groups-group-type" id="bp-groups-group-type"> 1058 <option value="" <?php selected( '', $current_type ); ?>><?php /* translators: no option picked in select box */ esc_attr_e( '----', 'buddypress' ) ?></option>1058 1059 <ul class="categorychecklist form-no-clear"> 1059 1060 <?php foreach ( $types as $type ) : ?> 1060 <option value="<?php echo esc_attr( $type->name ) ?>" <?php selected( $type->name, $current_type ) ?>><?php echo esc_html( $type->labels['singular_name'] ) ?></option> 1061 <li> 1062 <label class="selectit"><input value="<?php echo esc_attr( $type->name ) ?>" name="bp-groups-group-type[]" type="checkbox" <?php checked( true, in_array( $type->name, $current_types ) ); ?>> 1063 <?php 1064 echo esc_html( $type->labels['singular_name'] ); 1065 if ( in_array( $type->name, $backend_only ) ) { 1066 printf( ' <span class="description">%s</span>', esc_html__( '(Not available on the frontend)', 'buddypress' ) ); 1067 } 1068 ?> 1069 1070 </label> 1071 </li> 1072 1061 1073 <?php endforeach; ?> 1062 </select> 1074 1075 </ul> 1063 1076 1064 1077 <?php … … 1073 1086 */ 1074 1087 function bp_groups_process_group_type_update( $group_id ) { 1075 if ( ! isset( $_POST['bp-group-type-nonce'] ) || ! isset( $_POST['bp-groups-group-type'] )) {1088 if ( ! isset( $_POST['bp-group-type-nonce'] ) ) { 1076 1089 return; 1077 1090 } … … 1084 1097 } 1085 1098 1086 // Group type string must either reference a valid group type, or be empty. 1087 $group_type = wp_unslash( $_POST['bp-groups-group-type'] ); 1088 if ( $group_type && ! bp_groups_get_group_type_object( $group_type ) ) { 1089 return; 1090 } 1099 $group_types = ! empty( $_POST['bp-groups-group-type'] ) ? wp_unslash( $_POST['bp-groups-group-type'] ) : array(); 1091 1100 1092 1101 /* … … 1094 1103 * fishy with the POST request, so we can fail silently. 1095 1104 */ 1096 if ( bp_groups_set_group_type( $group_id, $group_type ) ) {1105 if ( bp_groups_set_group_type( $group_id, $group_types ) ) { 1097 1106 // @todo Success messages can't be posted because other stuff happens on the page load. 1098 1107 }
Note: See TracChangeset
for help on using the changeset viewer.