Skip to:

Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#6069 closed defect (bug) (fixed)

bp_core_fetch_avatar() no longer allows multiple classes to be passed to it

Reported by: needle's profile needle Owned by: imath's profile imath
Milestone: 2.2 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch commit


Because BP trunk uses sanitize_html_class( $params['class'] ), avatars can no longer be created with multiple classes. It used to be the case that one could define $avatar_options = array ( 'class' => 'first_class second_class' ), but sanitize_html_class() concatenates these into a single string, i.e. 'first_classsecond_class'. There's no workaround of passing an array.

Not sure if this is a bug or by design, so leaving Type = bug.

Attachments (2)

6069.patch (1.3 KB) - added by imath 9 years ago.
6069.unittests.patch (1.9 KB) - added by imath 9 years ago.

Download all attachments as: .zip

Change History (9)

#1 @DJPaul
10 years ago

  • Milestone changed from Awaiting Review to 2.2

The relevant change was r9125 and this appears to be a consequence of some added sanitisation. If you were using it as an array, there must be other people who were, so I'm suggesting we need to fix this for 2.2.

#2 @imath
9 years ago

  • Keywords has-patch added

I suggest 6069.patch

9 years ago

#3 @boonebgorges
9 years ago

  • Keywords needs-unit-tests added

6069.patch looks good. Would be nice to see a unit test or two, at least for the array regression.

#4 @imath
9 years ago

  • Keywords needs-unit-tests removed

Thanks for your feedback boonebgorges 6069.unittests.patch checks no value, "space separated" value and an array of classes.

#5 @boonebgorges
9 years ago

  • Keywords commit added

Looks great. Thanks imath.

#6 @imath
9 years ago

  • Owner set to imath
  • Resolution set to fixed
  • Status changed from new to closed

In 9381:

Allow multiple classes to be passed to the class argument of bp_core_fetch_avatar()

Using an array of classes or a list of classes separated by a space for the class argument of bp_core_fetch_avatar() will output each one of them into the class attribute of the image tag.

Fixes #6069

#7 @DJPaul
8 years ago

  • Component changed from API - Avatars to Media
Note: See TracTickets for help on using tickets.