Changeset 9885
- Timestamp:
- 05/21/2015 07:25:07 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-groups/bp-groups-template.php
r9848 r9885 672 672 * 673 673 * @since BuddyPress (1.7.0) 674 */ 675 function bp_group_class() { 676 echo bp_get_group_class(); 674 * 675 * @param array $classes Array of custom classes 676 */ 677 function bp_group_class( $classes = array() ) { 678 echo bp_get_group_class( $classes ); 677 679 } 678 680 /** … … 681 683 * @since BuddyPress (1.7.0) 682 684 * 685 * @param array $classes Array of custom classes 686 * 683 687 * @return string Row class of the group. 684 688 */ 685 function bp_get_group_class( ) {689 function bp_get_group_class( $classes = array() ) { 686 690 global $groups_template; 687 691 688 $classes = array();689 $pos_in_loop = (int) $groups_template->current_group;690 691 // If we've only one group in the loop, don't both with odd and even.692 if ( $groups_template->group_count > 1 ) 693 $classes[] = ( $pos_in_loop % 2 ) ? 'even' : 'odd';694 else692 // Add even/odd classes, but only if there's more than 1 group 693 if ( $groups_template->group_count > 1 ) { 694 $pos_in_loop = (int) $groups_template->current_group; 695 $classes[] = ( $pos_in_loop % 2 ) ? 'even' : 'odd'; 696 697 // If we've only one group in the loop, don't bother with odd and even 698 } else { 695 699 $classes[] = 'bp-single-group'; 700 } 696 701 697 702 // Group type - public, private, hidden. 698 $classes[] = esc_attr( $groups_template->group->status );699 700 // User's group status703 $classes[] = sanitize_key( $groups_template->group->status ); 704 705 // User's group role 701 706 if ( bp_is_user_active() ) { 702 if ( bp_group_is_admin() ) 707 708 // Admin 709 if ( bp_group_is_admin() ) { 703 710 $classes[] = 'is-admin'; 704 705 if ( bp_group_is_member() ) 711 } 712 713 // Moderator 714 if ( bp_group_is_mod() ) { 715 $classes[] = 'is-mod'; 716 } 717 718 // Member 719 if ( bp_group_is_member() ) { 706 720 $classes[] = 'is-member'; 707 708 if ( bp_group_is_mod() ) 709 $classes[] = 'is-mod'; 721 } 710 722 } 711 723
Note: See TracChangeset
for help on using the changeset viewer.