Changeset 12789
- Timestamp:
- 11/17/2020 07:31:44 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 10 edited
-
bp-groups/bp-groups-template.php (modified) (4 diffs)
-
bp-templates/bp-nouveau/buddypress/groups/groups-loop.php (modified) (2 diffs)
-
bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php (modified) (2 diffs)
-
bp-templates/bp-nouveau/buddypress/groups/single/group-header.php (modified) (3 diffs)
-
bp-templates/bp-nouveau/common-styles/_bp_group_header.scss (modified) (1 diff)
-
bp-templates/bp-nouveau/css/buddypress-rtl.css (modified) (2 diffs)
-
bp-templates/bp-nouveau/css/buddypress.css (modified) (2 diffs)
-
bp-templates/bp-nouveau/includes/groups/classes.php (modified) (2 diffs)
-
bp-templates/bp-nouveau/includes/groups/template-tags.php (modified) (3 diffs)
-
bp-templates/bp-nouveau/sass/buddypress.scss (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r12744 r12789 228 228 } 229 229 230 $r = bp_parse_args( $r, array( 231 'parent_element' => 'p', 232 'parent_attr' => array( 233 'class' => 'bp-group-type-list', 230 $r = bp_parse_args( 231 $r, 232 array( 233 'parent_element' => 'p', 234 'parent_attr' => array( 235 'class' => 'bp-group-type-list', 236 ), 237 'label' => __( 'Group Types:', 'buddypress' ), 238 'label_element' => 'strong', 239 'label_attr' => array(), 240 'show_all' => false, 241 'list_element' => '', 242 'list_element_attr' => array(), 234 243 ), 235 'label' => __( 'Group Types:', 'buddypress' ), 236 'label_element' => 'strong', 237 'label_attr' => array(), 238 'show_all' => false, 239 ), 'group_type_list' ); 244 'group_type_list' 245 ); 240 246 241 247 $retval = ''; … … 278 284 } 279 285 286 // The list of types. 287 $list = implode( ', ', array_map( 'bp_get_group_type_directory_link', $types ) ); 288 289 // Render the list of types element. 290 if ( ! empty( $r['list_element'] ) ) { 291 $list_element = new BP_Core_HTML_Element( array( 292 'element' => $r['list_element'], 293 'attr' => $r['list_element_attr'], 294 'inner_html' => $list, 295 ) ); 296 297 $list = $list_element->contents(); 298 } 299 280 300 // Comma-delimit each type into the group type directory link. 281 $label .= implode( ', ', array_map( 'bp_get_group_type_directory_link', $types ) );301 $label .= $list; 282 302 283 303 // Retval time! … … 2018 2038 * 2019 2039 * @since 1.2.0 2020 */ 2021 function bp_group_member_count() { 2022 echo bp_get_group_member_count(); 2040 * @since 7.0.0 Adds the `$group` optional parameter. 2041 * 2042 * @param object|bool $group Optional. Group object. Default: current group in loop. 2043 */ 2044 function bp_group_member_count( $group = false ) { 2045 echo bp_get_group_member_count( $group ); 2023 2046 } 2024 2047 /** … … 2027 2050 * @since 1.2.0 2028 2051 * 2052 * @since 7.0.0 Adds the `$group` optional parameter. 2053 * 2054 * @param object|bool $group Optional. Group object. Default: current group in loop. 2029 2055 * @return string 2030 2056 */ 2031 function bp_get_group_member_count( ) {2057 function bp_get_group_member_count( $group = false ) { 2032 2058 global $groups_template; 2033 2059 2034 if ( isset( $groups_template->group->total_member_count ) ) { 2060 if ( isset( $group->total_member_count ) ) { 2061 $count = (int) $group->total_member_count; 2062 } elseif ( isset( $groups_template->group->total_member_count ) ) { 2035 2063 $count = (int) $groups_template->group->total_member_count; 2036 2064 } else { -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/groups-loop.php
r12595 r12789 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 7.0.0 7 7 */ 8 8 … … 19 19 <ul id="groups-list" class="<?php bp_nouveau_loop_classes(); ?>"> 20 20 21 <?php 22 while ( bp_groups() ) : 23 bp_the_group(); 24 ?> 21 <?php while ( bp_groups() ) : bp_the_group(); ?> 25 22 26 <li <?php bp_group_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups">27 <div class="list-wrap">23 <li <?php bp_group_class( array( 'item-entry' ) ); ?> data-bp-item-id="<?php bp_group_id(); ?>" data-bp-item-component="groups"> 24 <div class="list-wrap"> 28 25 29 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?>30 <div class="item-avatar">31 <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( bp_nouveau_avatar_args() ); ?></a>32 </div>33 <?php endif; ?>26 <?php if ( ! bp_disable_group_avatar_uploads() ) : ?> 27 <div class="item-avatar"> 28 <a href="<?php bp_group_permalink(); ?>"><?php bp_group_avatar( bp_nouveau_avatar_args() ); ?></a> 29 </div> 30 <?php endif; ?> 34 31 35 <div class="item">32 <div class="item"> 36 33 37 <div class="item-block">34 <div class="item-block"> 38 35 39 <h2 class="list-title groups-title"><?php bp_group_link(); ?></h2>36 <h2 class="list-title groups-title"><?php bp_group_link(); ?></h2> 40 37 41 <?php if ( bp_nouveau_group_has_meta() ) : ?>38 <?php if ( bp_nouveau_group_has_meta() ) : ?> 42 39 43 <p class="item-meta group-details"><?php bp_nouveau_group_meta(); ?></p>40 <p class="item-meta group-details"><?php bp_nouveau_the_group_meta( array( 'keys' => array( 'status', 'count' ) ) ); ?></p> 44 41 45 <?php endif; ?>42 <?php endif; ?> 46 43 47 <p class="last-activity item-meta"> 48 <?php 49 printf( 50 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ 51 __( 'active %s', 'buddypress' ), 52 bp_get_group_last_active() 53 ); 54 ?> 55 </p> 44 <p class="last-activity item-meta"> 45 <?php 46 printf( 47 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ 48 esc_html__( 'Active %s', 'buddypress' ), 49 sprintf( 50 '<span data-livestamp="%1$s">%2$s</span>', 51 bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ), 52 esc_html( bp_get_group_last_active() ) 53 ) 54 ); 55 ?> 56 </p> 57 58 </div> 59 60 <div class="group-desc"><p><?php bp_nouveau_group_description_excerpt(); ?></p></div> 61 62 <?php bp_nouveau_groups_loop_item(); ?> 63 64 <?php bp_nouveau_groups_loop_buttons(); ?> 56 65 57 66 </div> 58 67 59 <div class="group-desc"><p><?php bp_nouveau_group_description_excerpt(); ?></p></div>60 61 <?php bp_nouveau_groups_loop_item(); ?>62 63 <?php bp_nouveau_groups_loop_buttons(); ?>64 65 68 </div> 66 69 70 </li> 67 71 68 </div> 69 </li> 70 71 <?php endwhile; ?> 72 <?php endwhile; ?> 72 73 73 74 </ul> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/cover-image-header.php
r12595 r12789 4 4 * 5 5 * @since 3.0.0 6 * @version 3.2.06 * @version 7.0.0 7 7 */ 8 8 ?> … … 22 22 <?php endif; ?> 23 23 24 <?phpif ( ! bp_nouveau_groups_front_page_description() ) : ?>25 <div id="item-header-content">24 <?php if ( ! bp_nouveau_groups_front_page_description() ) : ?> 25 <div id="item-header-content"> 26 26 27 <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_group_meta()->status ); ?></strong></p> 28 <p class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>"> 27 <?php if ( bp_nouveau_group_has_meta( 'status' ) ) : ?> 28 <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ) ); ?></strong></p> 29 <?php endif; ?> 30 31 <p class="activity"> 32 <?php 33 printf( 34 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ 35 esc_html__( 'Active %s', 'buddypress' ), 36 sprintf( 37 '<span data-livestamp="%1$s">%2$s</span>', 38 bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ), 39 esc_html( bp_get_group_last_active() ) 40 ) 41 ); 42 ?> 43 </p> 44 29 45 <?php 30 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ 31 printf( __( 'active %s', 'buddypress' ), bp_get_group_last_active() ); 46 bp_group_type_list( 47 bp_get_group_id(), 48 array( 49 'label' => __( 'Group Types', 'buddypress' ), 50 'list_element' => 'span', 51 ) 52 ); 32 53 ?> 33 </p>34 54 35 <?php echo bp_nouveau_group_meta()->group_type_list; ?> 36 <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?> 55 <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?> 37 56 38 <?php if ( bp_nouveau_group_has_meta_extra() ) : ?>39 <div class="item-meta">57 <?php if ( bp_nouveau_group_has_meta_extra() ) : ?> 58 <div class="item-meta"> 40 59 41 <?php echo bp_nouveau_group_meta()->extra; ?>60 <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?> 42 61 43 </div><!-- .item-meta -->44 <?php endif; ?>62 </div><!-- .item-meta --> 63 <?php endif; ?> 45 64 46 <?php bp_nouveau_group_header_buttons(); ?>65 <?php bp_nouveau_group_header_buttons(); ?> 47 66 48 </div><!-- #item-header-content -->49 <?php endif; ?>67 </div><!-- #item-header-content --> 68 <?php endif; ?> 50 69 51 70 <?php bp_get_template_part( 'groups/single/parts/header-item-actions' ); ?> -
trunk/src/bp-templates/bp-nouveau/buddypress/groups/single/group-header.php
r12595 r12789 4 4 * 5 5 * @since 3.0.0 6 * @version 3.2.06 * @version 7.0.0 7 7 */ 8 8 ?> … … 22 22 <div id="item-header-content"> 23 23 24 <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_group_meta()->status ); ?></strong></p> 24 <?php if ( bp_nouveau_group_has_meta( 'status' ) ) : ?> 25 <p class="highlight group-status"><strong><?php echo esc_html( bp_nouveau_the_group_meta( array( 'keys' => 'status' ) ) ); ?></strong></p> 26 <?php endif; ?> 25 27 26 <p class="activity" data-livestamp="<?php bp_core_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ); ?>">28 <p class="activity"> 27 29 <?php 28 echo esc_html( 29 sprintf( 30 printf( 30 31 /* translators: %s: last activity timestamp (e.g. "active 1 hour ago") */ 31 __( 'active %s', 'buddypress' ), 32 bp_get_group_last_active() 33 ) 34 ); 32 esc_html__( 'Active %s', 'buddypress' ), 33 sprintf( 34 '<span data-livestamp="%1$s">%2$s</span>', 35 bp_core_get_iso8601_date( bp_get_group_last_active( 0, array( 'relative' => false ) ) ), 36 esc_html( bp_get_group_last_active() ) 37 ) 38 ); 35 39 ?> 36 40 </p> 41 42 <?php 43 bp_group_type_list( 44 bp_get_group_id(), 45 array( 46 'label' => __( 'Group Types', 'buddypress' ), 47 'list_element' => 'span', 48 ) 49 ); 50 ?> 37 51 38 52 <?php bp_nouveau_group_hook( 'before', 'header_meta' ); ?> … … 41 55 <div class="item-meta"> 42 56 43 <?php echo bp_nouveau_ group_meta()->extra; ?>57 <?php echo bp_nouveau_the_group_meta( array( 'keys' => 'extra' ) ); ?> 44 58 45 59 </div><!-- .item-meta --> -
trunk/src/bp-templates/bp-nouveau/common-styles/_bp_group_header.scss
r12215 r12789 1 1 // BP Single Group Header Styles. 2 // @version 3.0.0 2 // @since 3.0.0 3 // @version 7.0.0 3 4 4 5 .groups-header { 5 6 6 7 .bp-group-type-list { 8 9 @include font-size(18); 7 10 margin: 0; 11 color: $black; 12 display: flex; 13 14 strong { 15 padding-right: $pad-med; 16 white-space: nowrap; 17 } 8 18 } 9 19 -
trunk/src/bp-templates/bp-nouveau/css/buddypress-rtl.css
r12779 r12789 2 2 Hello, this is the BuddyPress Nouveau stylesheet. 3 3 4 @version 4.0.0 4 @since 3.0.0 5 @version 7.0.0 5 6 6 7 ---------------------------------------------------------------- … … 2302 2303 */ 2303 2304 .groups-header .bp-group-type-list { 2305 font-size: 18px; 2304 2306 margin: 0; 2307 color: #333; 2308 display: flex; 2309 } 2310 2311 .groups-header .bp-group-type-list strong { 2312 padding-left: 1em; 2313 white-space: nowrap; 2305 2314 } 2306 2315 -
trunk/src/bp-templates/bp-nouveau/css/buddypress.css
r12779 r12789 2 2 Hello, this is the BuddyPress Nouveau stylesheet. 3 3 4 @version 4.0.0 4 @since 3.0.0 5 @version 7.0.0 5 6 6 7 ---------------------------------------------------------------- … … 2302 2303 */ 2303 2304 .groups-header .bp-group-type-list { 2305 font-size: 18px; 2304 2306 margin: 0; 2307 color: #333; 2308 display: flex; 2309 } 2310 2311 .groups-header .bp-group-type-list strong { 2312 padding-right: 1em; 2313 white-space: nowrap; 2305 2314 } 2306 2315 -
trunk/src/bp-templates/bp-nouveau/includes/groups/classes.php
r12435 r12789 4 4 * 5 5 * @since 3.0.0 6 * @version 3.0.06 * @version 7.0.0 7 7 */ 8 8 … … 377 377 } 378 378 } 379 380 /** 381 * Group template meta backwards compatibility class. 382 * 383 * @since 7.0.0 384 */ 385 class BP_Nouveau_Group_Meta { 386 /** 387 * Used to get the template meta used in Groups loop. 388 * 389 * @since 7.0.0 390 * @var string $meta The template meta used in Groups loop. 391 */ 392 public $meta = ''; 393 394 /** 395 * Magic getter. 396 * 397 * This exists specifically for supporting deprecated object vars. 398 * 399 * @since 7.0.0 400 * 401 * @param string $key 402 * @return string 403 */ 404 public function __get( $key = '' ) { 405 /* translators: %s is the name of the function to use instead of the deprecated one */ 406 _doing_it_wrong( 'bp_nouveau_group_meta', sprintf( __( 'Please use %s instead', 'buddypress' ), 'bp_nouveau_the_group_meta( array( \'keys\' => \'' . $key . '\' ) )' ) , '7.0.0' ); 407 408 // Backwards compatibility. 409 return bp_nouveau_the_group_meta( array( 'keys' => $key, 'echo' => false ) ); 410 } 411 412 /** 413 * Constructor 414 * 415 * @since 7.0.0 416 */ 417 public function __construct() { 418 // Backwards compatibility. 419 $this->meta = bp_nouveau_the_group_meta( array( 'echo' => false ) ); 420 } 421 } -
trunk/src/bp-templates/bp-nouveau/includes/groups/template-tags.php
r12567 r12789 1068 1068 */ 1069 1069 function bp_nouveau_group_has_meta( $meta_key = '' ) { 1070 $group_meta = bp_nouveau_get_group_meta();1071 1072 1070 if ( ! $meta_key ) { 1073 return (bool) $group_meta; 1074 } 1075 1076 return ! empty( $group_meta[ $meta_key ] ); 1071 $meta_keys = array( 'status', 'count' ); 1072 } else { 1073 $meta_keys = array( $meta_key ); 1074 } 1075 1076 $group_meta = bp_nouveau_get_group_meta( $meta_keys ); 1077 $group_meta = array_filter( $group_meta ); 1078 1079 return ! empty( $group_meta ); 1077 1080 } 1078 1081 … … 1085 1088 */ 1086 1089 function bp_nouveau_group_has_meta_extra() { 1087 return (bool)bp_nouveau_get_hooked_group_meta();1090 return false !== bp_nouveau_get_hooked_group_meta(); 1088 1091 } 1089 1092 … … 1092 1095 * 1093 1096 * @since 3.0.0 1097 * @deprecated 7.0.0 Use bp_nouveau_the_group_meta() 1098 * @see bp_nouveau_the_group_meta() 1094 1099 * 1095 1100 * @return string HTML Output. 1096 1101 */ 1097 1102 function bp_nouveau_group_meta() { 1098 $meta = bp_nouveau_get_group_meta(); 1103 _deprecated_function( __FUNCTION__, '7.0.0', 'bp_nouveau_the_group_meta()' ); 1104 $group_meta = new BP_Nouveau_Group_Meta(); 1099 1105 1100 1106 if ( ! bp_is_group() ) { 1101 echo join( ' / ', array_map( 'esc_html', (array) $meta ) );1107 echo $group_meta->meta; 1102 1108 } else { 1103 1104 /* 1105 * Lets return an object not echo an array here for the single groups, 1106 * more flexible for the template!!?? ~hnla 1109 return $group_meta; 1110 } 1111 } 1112 1113 /** 1114 * Outputs or returns the group meta(s). 1115 * 1116 * @since 7.0.0 1117 * 1118 * @param array $args { 1119 * Optional. An array of arguments. 1120 * 1121 * @type array $keys The list of template meta keys. 1122 * @type string $delimeter The delimeter to use in case there is more than 1123 * one key to output. 1124 * @type boolean $echo True to output the template meta value. False otherwise. 1125 * } 1126 * @return string HTML Output. 1127 */ 1128 function bp_nouveau_the_group_meta( $args = array() ) { 1129 $r = bp_parse_args( $args, array( 1130 'keys' => array(), 1131 'delimeter' => '/', 1132 'echo' => true, 1133 ), 'nouveau_the_group_meta' ); 1134 1135 $group_meta = (array) bp_nouveau_get_group_meta( $r['keys'] ); 1136 1137 if ( ! $group_meta ) { 1138 return; 1139 } 1140 1141 $meta = ''; 1142 if ( 1 < count( $group_meta ) ) { 1143 $group_meta = array_filter( $group_meta ); 1144 $meta = join( ' ' . $r['delimeter'] . ' ', array_map( 'esc_html', $group_meta ) ); 1145 } else { 1146 $meta = reset( $group_meta ); 1147 } 1148 1149 if ( ! $r['echo'] ) { 1150 return $meta; 1151 } 1152 1153 echo $meta; 1154 } 1155 1156 /** 1157 * Get the group template meta. 1158 * 1159 * @since 3.0.0 1160 * @since 7.0.0 Adds the `$keys` parameter. 1161 * 1162 * @param array $keys One or more template meta keys to populate with their values. 1163 * Possible keys are `status`, `count`, `group_type_list`, `description`, `extra`. 1164 * @return array The corresponding group template meta values. 1165 */ 1166 function bp_nouveau_get_group_meta( $keys = array() ) { 1167 $keys = (array) $keys; 1168 $group = false; 1169 $group_meta = array(); 1170 $is_group = bp_is_group(); 1171 1172 if ( isset( $GLOBALS['groups_template']->group ) ) { 1173 $group = $GLOBALS['groups_template']->group; 1174 } else { 1175 $group = groups_get_current_group(); 1176 } 1177 1178 if ( ! $group ) { 1179 return ''; 1180 } 1181 1182 if ( ! $keys && ! $is_group ) { 1183 $keys = array( 'status', 'count' ); 1184 } 1185 1186 foreach ( $keys as $key ) { 1187 switch ( $key ) { 1188 case 'status' : 1189 $group_meta['status'] = bp_get_group_type( $group ); 1190 break; 1191 1192 case 'count' : 1193 $group_meta['count'] = bp_get_group_member_count( $group ); 1194 break; 1195 1196 case 'group_type_list' : 1197 $group_meta['group_type_list'] = bp_get_group_type_list( $group->id ); 1198 break; 1199 1200 case 'description' : 1201 $group_meta['description'] = bp_get_group_description( $group ); 1202 break; 1203 1204 case 'extra' : 1205 $group_meta['extra'] = ''; 1206 1207 if ( $is_group ) { 1208 $group_meta['extra'] = bp_nouveau_get_hooked_group_meta(); 1209 } 1210 break; 1211 } 1212 } 1213 1214 /** 1215 * Filter to add/remove Group template meta. 1107 1216 * 1108 * @todo Paul says that a function that prints and/or returns a value, 1109 * depending on global state, is madness. This needs changing. 1217 * @since 3.0.0 1218 * 1219 * @param array $group_meta The list of meta to output. 1220 * @param object $group The current Group of the loop object. 1221 * @param bool $is_group True if a single group is displayed. False otherwise. 1110 1222 */ 1111 return (object) bp_nouveau_get_group_meta(); 1112 } 1113 } 1114 1115 /** 1116 * Get the group meta. 1117 * 1118 * @since 3.0.0 1119 * 1120 * @return array The group meta. 1121 */ 1122 function bp_nouveau_get_group_meta() { 1123 /* 1124 * @todo For brevity required approapriate markup is added here as strings 1125 * this needs to be either filterable or the function needs to be able to accept 1126 * & parse args! 1127 */ 1128 $meta = array(); 1129 $is_group = bp_is_group(); 1130 1131 if ( ! empty( $GLOBALS['groups_template']->group ) ) { 1132 $group = $GLOBALS['groups_template']->group; 1133 } 1134 1135 if ( empty( $group->id ) ) { 1136 return $meta; 1137 } 1138 1139 if ( empty( $group->template_meta ) ) { 1140 // It's a single group 1141 if ( $is_group ) { 1142 $meta = array( 1143 'status' => bp_get_group_type(), 1144 'group_type_list' => bp_get_group_type_list(), 1145 'description' => bp_get_group_description(), 1146 ); 1147 1148 // Make sure to include hooked meta. 1149 $extra_meta = bp_nouveau_get_hooked_group_meta(); 1150 1151 if ( $extra_meta ) { 1152 $meta['extra'] = $extra_meta; 1153 } 1154 1155 // We're in the groups loop 1156 } else { 1157 $meta = array( 1158 'status' => bp_get_group_type(), 1159 'count' => bp_get_group_member_count(), 1160 ); 1161 } 1162 1163 /** 1164 * Filter to add/remove Group meta. 1165 * 1166 * @since 3.0.0 1167 * 1168 * @param array $meta The list of meta to output. 1169 * @param object $group The current Group of the loop object. 1170 * @param bool $is_group True if a single group is displayed. False otherwise. 1171 */ 1172 $group->template_meta = apply_filters( 'bp_nouveau_get_group_meta', $meta, $group, $is_group ); 1173 } 1174 1175 return $group->template_meta; 1223 return apply_filters( 'bp_nouveau_get_group_meta', $group_meta, $group, $is_group ); 1176 1224 } 1177 1225 -
trunk/src/bp-templates/bp-nouveau/sass/buddypress.scss
r12172 r12789 27 27 Hello, this is the BuddyPress Nouveau stylesheet. 28 28 29 @version 4.0.0 29 @since 3.0.0 30 @version 7.0.0 30 31 31 32 ----------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.