[buddypress-trac] [BuddyPress Trac] #7301: Add Member & Group ' types' string to body class array for bp_user/groups single screens

buddypress-trac noreply at wordpress.org
Mon Oct 24 15:15:38 UTC 2016


#7301: Add Member & Group ' types' string to body class array for  bp_user/groups
single screens
-------------------------+------------------
 Reporter:  hnla         |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  low          |   Milestone:  2.8
Component:  Core         |     Version:
 Severity:  minor        |  Resolution:
 Keywords:               |
-------------------------+------------------

Comment (by Offereins):

 Makes so much sense +1. Mind that we already support multiple types in
 `bp_get_member_class()`, so I'd do:
 {{{
                 // Add current user member types.
                 if ( $member_types = bp_get_member_type(
 bp_displayed_user_id(), false ) ) {
                         foreach ( $member_types as $member_type ) {
                                 $bp_classes[] = sprintf( 'member-type-%s',
 esc_attr( $member_type ) );
                         }
                 }
 }}}

 Although the group types aren't yet part of `bp_get_group_class()`
 (another opportunity there!), you can mimic this for group types, like so:
 {{{
                 // Add current group types.
                 if ( $group_types = bp_groups_get_group_type(
 bp_get_current_group_id(), false ) ) {
                         foreach ( $group_types as $group_type ) {
                                 $bp_classes[] = sprintf( 'group-type-%s',
 esc_attr( $group_type ) );
                         }
                 }
 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7301#comment:1>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list