Skip to content

Commit

Permalink
Translate: Avoid PHP Warnings for non-existent users in the stats cron.
Browse files Browse the repository at this point in the history
See [12114].


git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14029 74240141-8908-4e6f-9713-ba540dce6ec7
  • Loading branch information
dd32 committed Sep 9, 2024
1 parent 50a96b8 commit 5e30ad8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,11 @@ private function print_feedback_received() {

$commenters_number = number_format_i18n( count( $commenters_with_comment_count ) );
foreach ( $commenters_with_comment_count as $user_id => $comment_number ) {
$user = get_user_by( 'id', $user_id );
$user = get_user_by( 'id', $user_id );
if ( ! $user ) {
continue;
}

$user->comments_number = $comment_number;
$commenters[] = $user;
}
Expand Down Expand Up @@ -1093,7 +1097,7 @@ private function print_feedback_received() {
} else {
$tabs = "\t\t";
}
$url = 'https://profiles.wordpress.org/' . sanitize_title_with_dashes( $commenter->user_login );
$url = 'https://profiles.wordpress.org/' . $commenter->user_nicename . '/';
$comments_number = number_format_i18n( $commenter->comments_number );
$code .= " - {$commenter->user_login}: {$tabs} {$comments_number} comments. Profile: {$url}" . PHP_EOL;
}
Expand Down

0 comments on commit 5e30ad8

Please sign in to comment.