Changeset 11145
- Timestamp:
- 09/21/2016 10:53:11 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-core/bp-core-template.php
r11048 r11145 2687 2687 */ 2688 2688 function bp_is_groups_directory() { 2689 if ( bp_is_groups_component() && ! bp_ current_action() && ! bp_current_item() ) {2689 if ( bp_is_groups_component() && ! bp_is_group() && ( ! bp_current_action() || ( bp_action_variable() && bp_is_current_action( bp_get_groups_group_type_base() ) ) ) ) { 2690 2690 return true; 2691 2691 } -
trunk/src/bp-groups/bp-groups-functions.php
r11144 r11145 2446 2446 2447 2447 /** 2448 * Get the "current" group type, if one is provided, in group directories. 2449 * 2450 * @since 2.7.0 2451 * 2452 * @return string 2453 */ 2454 function bp_get_current_group_directory_type() { 2455 2456 /** 2457 * Filters the "current" group type, if one is provided, in group directories. 2458 * 2459 * @since 2.7.0 2460 * 2461 * @param string $value "Current" group type. 2462 */ 2463 return apply_filters( 'bp_get_current_group_directory_type', buddypress()->groups->current_directory_type ); 2464 } 2465 2466 /** 2448 2467 * Delete a group's type when the group is deleted. 2449 2468 * -
trunk/src/bp-groups/bp-groups-screens.php
r11091 r11145 26 26 function groups_directory_groups_setup() { 27 27 if ( bp_is_groups_directory() ) { 28 // Set group type if available. 29 if ( bp_is_current_action( bp_get_groups_group_type_base() ) && bp_action_variable() ) { 30 $matched_types = bp_groups_get_group_types( array( 31 'has_directory' => true, 32 'directory_slug' => bp_action_variable(), 33 ) ); 34 35 // Redirect back to group directory if no match. 36 if ( empty( $matched_types ) ) { 37 bp_core_redirect( bp_get_groups_directory_permalink() ); 38 } 39 40 // Set our global variable. 41 buddypress()->groups->current_directory_type = reset( $matched_types ); 42 } 43 28 44 bp_update_is_directory( true, 'groups' ); 29 45 -
trunk/src/bp-groups/bp-groups-template.php
r11129 r11145 70 70 */ 71 71 return apply_filters( 'bp_get_groups_root_slug', buddypress()->groups->root_slug ); 72 } 73 74 /** 75 * Output the group type base slug. 76 * 77 * @since 2.7.0 78 */ 79 function bp_groups_group_type_base() { 80 echo esc_url( bp_get_groups_group_type_base() ); 81 } 82 /** 83 * Get the group type base slug. 84 * 85 * The base slug is the string used as the base prefix when generating group 86 * type directory URLs. For example, in example.com/groups/type/foo/, 'foo' is 87 * the group type and 'type' is the base slug. 88 * 89 * @since 2.7.0 90 * 91 * @return string 92 */ 93 function bp_get_groups_group_type_base() { 94 /** 95 * Filters the group type URL base. 96 * 97 * @since 2.7.0 98 * 99 * @param string $base 100 */ 101 return apply_filters( 'bp_groups_group_type_base', _x( 'type', 'group type URL base', 'buddypress' ) ); 72 102 } 73 103 … … 174 204 } 175 205 206 $group_type = bp_get_current_group_directory_type(); 207 if ( ! $group_type && ! empty( $_GET['group_type'] ) ) { 208 if ( is_array( $_GET['group_type'] ) ) { 209 $group_type = $_GET['group_type']; 210 } else { 211 // Can be a comma-separated list. 212 $group_type = explode( ',', $_GET['group_type'] ); 213 } 214 } 215 176 216 // Default search string (too soon to escape here). 177 217 $search_query_arg = bp_core_get_component_search_query_arg( 'groups' ); … … 197 237 'slug' => $slug, 198 238 'search_terms' => $search_terms, 199 'group_type' => '',239 'group_type' => $group_type, 200 240 'group_type__in' => '', 201 241 'group_type__not_in' => '', … … 5080 5120 5081 5121 /** 5122 * Echo the current group type message. 5123 * 5124 * @since 2.7.0 5125 */ 5126 function bp_current_group_directory_type_message() { 5127 echo bp_get_current_group_directory_type_message(); 5128 } 5129 /** 5130 * Generate the current group type message. 5131 * 5132 * @since 2.7.0 5133 * 5134 * @return string 5135 */ 5136 function bp_get_current_group_directory_type_message() { 5137 $type_object = bp_groups_get_group_type_object( bp_get_current_group_directory_type() ); 5138 5139 $message = sprintf( __( 'Viewing groups of the type: %s', 'buddypress' ), '<strong>' . $type_object->labels['singular_name'] . '</strong>' ); 5140 5141 /** 5142 * Filters the current group type message. 5143 * 5144 * @since 2.7.0 5145 * 5146 * @param string $message Message to filter. 5147 */ 5148 return apply_filters( 'bp_get_current_group_type_message', $message ); 5149 } 5150 5151 /** 5082 5152 * Is the current page a specific group admin screen? 5083 5153 * -
trunk/src/bp-groups/classes/class-bp-groups-component.php
r11091 r11145 84 84 */ 85 85 public $types = array(); 86 87 /** 88 * Current directory group type. 89 * 90 * @see groups_directory_groups_setup() 91 * 92 * @since 2.7.0 93 * @var string 94 */ 95 public $current_directory_type = ''; 86 96 87 97 /** -
trunk/src/bp-groups/classes/class-bp-groups-theme-compat.php
r10520 r11145 41 41 42 42 // Group Directory. 43 if ( ! bp_current_action() && ! bp_current_item() ) {43 if ( bp_is_groups_directory() ) { 44 44 bp_update_is_directory( true, 'groups' ); 45 45 -
trunk/src/bp-templates/bp-legacy/buddypress/groups/groups-loop.php
r11008 r11145 19 19 */ 20 20 do_action( 'bp_before_groups_loop' ); ?> 21 22 <?php if ( bp_get_current_group_directory_type() ) : ?> 23 <p class="current-group-type"><?php bp_current_group_directory_type_message() ?></p> 24 <?php endif; ?> 21 25 22 26 <?php if ( bp_has_groups( bp_ajax_querystring( 'groups' ) ) ) : ?>
Note: See TracChangeset
for help on using the changeset viewer.