Changeset 11146
- Timestamp:
- 09/21/2016 10:59:04 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-actions.php
r11095 r11146 209 209 bp_core_add_message( __( 'There was an error saving group details. Please try again.', 'buddypress' ), 'error' ); 210 210 bp_core_redirect( trailingslashit( bp_get_groups_directory_permalink() . 'create/step/' . bp_get_groups_current_create_step() ) ); 211 } 212 213 // Save group types. 214 if ( ! empty( $_POST['group-types'] ) ) { 215 bp_groups_set_group_type( $bp->groups->new_group_id, $_POST['group-types'] ); 211 216 } 212 217 -
trunk/src/bp-groups/bp-groups-screens.php
r11145 r11146 931 931 if ( !check_admin_referer( 'groups_edit_group_settings' ) ) 932 932 return false; 933 934 /* 935 * Save group types. 936 * 937 * Ensure we keep types that have 'show_in_create_screen' set to false. 938 */ 939 $current_types = bp_groups_get_group_type( bp_get_current_group_id(), false ); 940 $current_types = array_intersect( bp_groups_get_group_types( array( 'show_in_create_screen' => false ) ), (array) $current_types ); 941 if ( isset( $_POST['group-types'] ) ) { 942 $current_types = array_merge( $current_types, $_POST['group-types'] ); 943 944 // Set group types. 945 bp_groups_set_group_type( bp_get_current_group_id(), $current_types ); 946 947 // No group types checked, so this means we want to wipe out all group types. 948 } else { 949 /* 950 * Passing a blank string will wipe out all types for the group. 951 * 952 * Ensure we keep types that have 'show_in_create_screen' set to false. 953 */ 954 $current_types = empty( $current_types ) ? '' : $current_types; 955 956 // Set group types. 957 bp_groups_set_group_type( bp_get_current_group_id(), $current_types ); 958 } 933 959 934 960 if ( !groups_edit_group_settings( $_POST['group-id'], $enable_forum, $status, $invite_status ) ) { -
trunk/src/bp-groups/bp-groups-template.php
r11145 r11146 127 127 */ 128 128 return apply_filters( 'bp_get_groups_directory_permalink', trailingslashit( bp_get_root_domain() . '/' . bp_get_groups_root_slug() ) ); 129 } 130 131 /** 132 * Output group type directory permalink. 133 * 134 * @since 2.7.0 135 * 136 * @param string $group_type Optional. Group type. 137 */ 138 function bp_group_type_directory_permalink( $group_type = '' ) { 139 echo esc_url( bp_get_group_type_directory_permalink( $group_type ) ); 140 } 141 /** 142 * Return group type directory permalink. 143 * 144 * @since 2.7.0 145 * 146 * @param string $group_type Optional. Group type. Defaults to current group type. 147 * @return string Group type directory URL on success, an empty string on failure. 148 */ 149 function bp_get_group_type_directory_permalink( $group_type = '' ) { 150 151 if ( $group_type ) { 152 $_group_type = $group_type; 153 } else { 154 // Fall back on the current group type. 155 $_group_type = bp_get_current_group_directory_type(); 156 } 157 158 $type = bp_groups_get_group_type_object( $_group_type ); 159 160 // Bail when member type is not found or has no directory. 161 if ( ! $type || ! $type->has_directory ) { 162 return ''; 163 } 164 165 /** 166 * Filters the group type directory permalink. 167 * 168 * @since 2.7.0 169 * 170 * @param string $value Group type directory permalink. 171 * @param object $type Group type object. 172 * @param string $member_type Group type name, as passed to the function. 173 */ 174 return apply_filters( 'bp_get_group_type_directory_permalink', trailingslashit( bp_get_groups_directory_permalink() . bp_get_groups_group_type_base() . '/' . $type->directory_slug ), $type, $group_type ); 175 } 176 177 /** 178 * Output group type directory link. 179 * 180 * @since 2.7.0 181 * 182 * @param string $group_type Unique group type identifier as used in bp_groups_register_group_type(). 183 */ 184 function bp_group_type_directory_link( $group_type = '' ) { 185 echo bp_get_group_type_directory_link( $group_type ); 186 } 187 /** 188 * Return group type directory link. 189 * 190 * @since 2.7.0 191 * 192 * @param string $group_type Unique group type identifier as used in bp_groups_register_group_type(). 193 * @return string 194 */ 195 function bp_get_group_type_directory_link( $group_type = '' ) { 196 if ( empty( $group_type ) ) { 197 return ''; 198 } 199 200 return sprintf( '<a href="%s">%s</a>', esc_url( bp_get_group_type_directory_permalink( $group_type ) ), bp_groups_get_group_type_object( $group_type )->labels['name'] ); 201 } 202 203 /** 204 * Output a comma-delimited list of group types. 205 * 206 * @since 2.7.0 207 * @see bp_get_group_type_list() for parameter documentation. 208 */ 209 function bp_group_type_list( $group_id = 0, $r = array() ) { 210 echo bp_get_group_type_list( $group_id, $r ); 211 } 212 /** 213 * Return a comma-delimited list of group types. 214 * 215 * @since 2.7.0 216 * 217 * @param int $group_id Group ID. Defaults to current group ID if on a group page. 218 * @param array|string $args { 219 * Array of parameters. All items are optional. 220 * @type string $parent_element Element to wrap around the list. Defaults to 'p'. 221 * @type array $parent_attr Element attributes for parent element. Defaults to 222 * array( 'class' => 'bp-group-type-list' ). 223 * @type string $label Label to add before the list. Defaults to 'Group Types:'. 224 * @type string $label_element Element to wrap around the label. Defaults to 'strong'. 225 * @type array $label_attr Element attributes for label element. Defaults to array(). 226 * } 227 * @return string 228 */ 229 function bp_get_group_type_list( $group_id = 0, $r = array() ) { 230 if ( empty( $group_id ) ) { 231 $group_id = bp_get_current_group_id(); 232 } 233 234 $r = bp_parse_args( $r, array( 235 'parent_element' => 'p', 236 'parent_attr' => array( 237 'class' => 'bp-group-type-list', 238 ), 239 'label' => __( 'Group Types:', 'buddypress' ), 240 'label_element' => 'strong', 241 'label_attr' => array() 242 ), 'group_type_list' ); 243 244 $retval = ''; 245 246 if ( $types = bp_groups_get_group_type( $group_id, false ) ) { 247 // Make sure we can show the type in the list. 248 $types = array_intersect( bp_groups_get_group_types( array( 'show_in_list' => true ) ), $types ); 249 if ( empty( $types ) ) { 250 return $retval; 251 } 252 253 $before = $after = $label = ''; 254 255 // Render parent element. 256 if ( ! empty( $r['parent_element'] ) ) { 257 $parent_elem = new BP_Core_HTML_Element( array( 258 'element' => $r['parent_element'], 259 'attr' => $r['parent_attr'] 260 ) ); 261 262 // Set before and after. 263 $before = $parent_elem->get( 'open_tag' ); 264 $after = $parent_elem->get( 'close_tag' ); 265 } 266 267 // Render label element. 268 if ( ! empty( $r['label_element'] ) ) { 269 $label = new BP_Core_HTML_Element( array( 270 'element' => $r['label_element'], 271 'attr' => $r['label_attr'], 272 'inner_html' => esc_html( $r['label'] ) 273 ) ); 274 $label = $label->contents() . ' '; 275 276 // No element, just the label. 277 } else { 278 $label = esc_html( $r['label'] ); 279 } 280 281 // Comma-delimit each type into the group type directory link. 282 $label .= implode( ', ', array_map( 'bp_get_group_type_directory_link', $types ) ); 283 284 // Retval time! 285 $retval = $before . $label . $after; 286 } 287 288 return $retval; 129 289 } 130 290 -
trunk/src/bp-templates/bp-legacy/buddypress/groups/create.php
r11129 r11146 136 136 137 137 </fieldset> 138 139 <?php // Group type selection ?> 140 <?php if ( $group_types = bp_groups_get_group_types( array( 'show_in_create_screen' => true ), 'objects' ) ): ?> 141 142 <fieldset class="group-create-types"> 143 <legend><?php _e( 'Group Types', 'buddypress' ); ?></legend> 144 145 <p><?php _e( 'Select the types this group should be a part of.', 'buddypress' ); ?></p> 146 147 <?php foreach ( $group_types as $type ) : ?> 148 <div class="checkbox"> 149 <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 esc_attr_e( $type->name ); ?>" /> <?php esc_html_e( $type->labels['name'] ); ?> 150 <?php 151 if ( isset( $type->description ) ) { 152 printf( __( '– %s', 'buddypress' ), '<span class="bp-group-type-desc">' . $type->description . '</span>' ); 153 } 154 ?> 155 </label> 156 </div> 157 158 <?php endforeach; ?> 159 160 </fieldset> 161 162 <?php endif; ?> 138 163 139 164 <fieldset class="group-create-invitations"> -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/admin/group-settings.php
r11051 r11146 68 68 </fieldset> 69 69 70 <?php // Group type selection ?> 71 <?php if ( $group_types = bp_groups_get_group_types( array( 'show_in_create_screen' => true ), 'objects' ) ): ?> 72 73 <fieldset class="group-create-types"> 74 <legend><?php _e( 'Group Types', 'buddypress' ); ?></legend> 75 76 <p><?php _e( 'Select the types this group should be a part of.', 'buddypress' ); ?></p> 77 78 <?php foreach ( $group_types as $type ) : ?> 79 <div class="checkbox"> 80 <label for="<?php printf( 'group-type-%s', $type->name ); ?>"> 81 <input type="checkbox" name="group-types[]" id="<?php printf( 'group-type-%s', $type->name ); ?>" value="<?php esc_attr_e( $type->name ); ?>" <?php checked( bp_groups_has_group_type( bp_get_current_group_id(), $type->name ) ); ?>/> <?php esc_html_e( $type->labels['name'] ); ?> 82 <?php 83 if ( ! empty( $type->description ) ) { 84 printf( __( '– %s', 'buddypress' ), '<span class="bp-group-type-desc">' . esc_html( $type->description ) . '</span>' ); 85 } 86 ?> 87 </label> 88 </div> 89 90 <?php endforeach; ?> 91 92 </fieldset> 93 94 <?php endif; ?> 95 70 96 <fieldset class="group-create-invitations"> 71 97 -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/cover-image-header.php
r11008 r11146 64 64 <?php bp_group_description(); ?> 65 65 66 <?php bp_group_type_list(); ?> 66 67 </div> 67 68 </div><!-- #item-header-content --> -
trunk/src/bp-templates/bp-legacy/buddypress/groups/single/group-header.php
r11008 r11146 84 84 <?php bp_group_description(); ?> 85 85 86 <?php bp_group_type_list(); ?> 87 86 88 <div id="item-buttons"> 87 89
Note: See TracChangeset
for help on using the changeset viewer.