Skip to content

Commit

Permalink
Fix - #224 Avoid php warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
BhargavBhandari90 committed Mar 10, 2024
1 parent ebf18d9 commit 51b2389
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 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' );
if ( ! empty( $avatar_rating ) && 'G' !== $avatar_rating && $site_rating ) {
$ratings = array_keys( $this->avatar_ratings );
$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 && $all_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 51b2389

Please sign in to comment.