WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

#34744 closed defect (bug) (fixed)

Don't use regex replacement to set force_default to true for images under Settings > Discussion > Default Avatar

Reported by: henry.wright Owned by: swissspidy
Milestone: 4.6 Priority: normal
Severity: normal Version: 4.2
Component: Administration Keywords: has-patch commit
Focuses: Cc:

Description

Now that get_avatar() accepts a 5th param, we should use it to set force_default instead of using preg_replace(). Patch to follow...

Attachments (2)

34744.diff (1.3 KB) - added by henry.wright 5 years ago.
34744.2.diff (1.3 KB) - added by swissspidy 4 years ago.

Download all attachments as: .zip

Change History (12)

@henry.wright
5 years ago

#1 @henry.wright
5 years ago

  • Keywords has-patch added

#2 @swissspidy
5 years ago

  • Milestone changed from Awaiting Review to Future Release

#3 @henry.wright
4 years ago

I should mention, this will help fix BuddyPress #buddypress6298.

Version 1, edited 4 years ago by ocean90 (previous) (next) (diff)

#4 @swissspidy
4 years ago

  • Milestone changed from Future Release to 4.5
  • Owner set to swissspidy
  • Status changed from new to reviewing
  • Type changed from enhancement to defect (bug)
  • Version changed from 4.3.1 to 4.2

@swissspidy
4 years ago

#5 @swissspidy
4 years ago

Note: The resulting HTML, which is being filtered in default_avatar_select, changes slightly using this patch. Instead of appending forcedefault=1 to the URL, it contains &f=y.

Not a big deal, but I'm not sure if it's big enough to skip for 4.5

#6 @henry.wright
4 years ago

According to Grav, either f or forcedefault can be used as the param:

https://en.gravatar.com/site/implement/images/#force-default

#7 @swissspidy
4 years ago

  • Milestone changed from 4.5 to Future Release

#8 @swissspidy
4 years ago

  • Milestone changed from Future Release to 4.6

#9 @swissspidy
4 years ago

  • Keywords commit added

#10 @swissspidy
4 years ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 37227:

Admin: Fix default avatar handling in Settings -> Discussion.

By passing the force_default argument to get_avatar() instead of using preg_replace, we make it easier for developers to override the output.

Props henry.wright.
Fixes #34744.

Note: See TracTickets for help on using tickets.