-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix widget gravatar and language settings #706
Conversation
@@ -113,9 +118,14 @@ protected function build_settings( $settings ) { | |||
|
|||
$options_obj['socialButtonStyle'] = 'big'; | |||
|
|||
if ( isset( $settings['gravatar'] ) && empty( $settings['gravatar'] ) ) { | |||
if ( isset( $settings['gravatar'] ) && '' !== $settings['gravatar'] && empty( $settings['gravatar'] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty is already "". If you check for !=""
and empty
at the same time, this will never be called! What is going on here? 🤕
'' !== $settings['gravatar'] && empty( $settings['gravatar'] )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a little wonky because it has a number of settings arrays that override each other with successive option building.
''
is an empty string (in this case, means use the default), isset()
is whether that key exists or not (avoids Undefined index
errors), and empty()
checks for 0
, null
, false
, etc.
$options_obj['avatar'] = null; | ||
} | ||
|
||
if ( ! empty( $settings['gravatar'] ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you check for empty
but not for isset
, why ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
empty()
covers the isset()
case. Means "no truth-y value to use".
Changes
Note to reviewers: PO, MO, and POT files can be ignored.