Skip to content

Commit

Permalink
Merge pull request #261 from BhargavBhandari90/fix/issue-224
Browse files Browse the repository at this point in the history
Fix - #224 Avoid php warnings
  • Loading branch information
dkotter authored Mar 12, 2024
2 parents 758f512 + 31319ab commit 3089823
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions includes/class-simple-local-avatars.php
Original file line number Diff line number Diff line change
Expand Up @@ -342,10 +342,13 @@ public function get_simple_local_avatar_url( $id_or_email, $size ) {
}

// check rating
$avatar_rating = get_user_meta( $user_id, $this->rating_key, true );
$site_rating = get_option( 'avatar_rating' );
$avatar_rating = get_user_meta( $user_id, $this->rating_key, true );
$site_rating = get_option( 'avatar_rating' );
$all_avatar_ratings = ! empty( $this->avatar_ratings ) && is_array( $this->avatar_ratings )
? $this->avatar_ratings
: array();
if ( ! empty( $avatar_rating ) && 'G' !== $avatar_rating && $site_rating ) {
$ratings = array_keys( $this->avatar_ratings );
$ratings = array_keys( $all_avatar_ratings );
$site_rating_weight = array_search( $site_rating, $ratings, true );
$avatar_rating_weight = array_search( $avatar_rating, $ratings, true );
if ( false !== $avatar_rating_weight && $avatar_rating_weight > $site_rating_weight ) {
Expand Down

0 comments on commit 3089823

Please sign in to comment.