Skip to:
Content

BuddyPress.org

Ticket #6069: 6069.patch

File 6069.patch, 1.3 KB (added by imath, 7 years ago)
  • src/bp-core/bp-core-avatars.php

    diff --git src/bp-core/bp-core-avatars.php src/bp-core/bp-core-avatars.php
    index f2d7881..b7b3956 100644
    function bp_core_fetch_avatar( $args = '' ) { 
    334334
    335335        // Create CSS class html string
    336336        $params['class'] = apply_filters( 'bp_core_avatar_class', $params['class'], $params['item_id'], $params['object'], $params );
    337         $html_class = ' class="' . sanitize_html_class( $params['class'] ) . ' ' . sanitize_html_class( $params['object'] . '-' . $params['item_id'] . '-avatar' ) . ' ' . sanitize_html_class( 'avatar-' . $params['width'] ) . ' photo"';
     337
     338        // Use an alias to leave the param unchanged
     339        $avatar_classes = $params['class'];
     340        if ( ! is_array( $avatar_classes ) ) {
     341                $avatar_classes = explode( ' ', $avatar_classes );
     342        }
     343
     344        // merge classes
     345        $avatar_classes = array_merge( $avatar_classes, array(
     346                $params['object'] . '-' . $params['item_id'] . '-avatar',
     347                'avatar-' . $params['width'],
     348        ) );
     349
     350        // Sanitize each class
     351        $avatar_classes = array_map( 'sanitize_html_class', $avatar_classes );
     352
     353        // populate the class attribute
     354        $html_class = ' class="' . join( ' ', $avatar_classes ) . ' photo"';
    338355
    339356        // Set img URL and DIR based on prepopulated constants
    340357        $avatar_loc        = new stdClass();