Making WordPress.org

Changeset 14029


Ignore:
Timestamp:
09/09/2024 02:49:30 AM (8 months ago)
Author:
dd32
Message:

Translate: Avoid PHP Warnings for non-existent users in the stats cron.

See [12114].

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/cli/class-stats.php

    r13774 r14029  
    10601060        $commenters_number = number_format_i18n( count( $commenters_with_comment_count ) );
    10611061        foreach ( $commenters_with_comment_count as $user_id => $comment_number ) {
    1062             $user                  = get_user_by( 'id', $user_id );
     1062            $user = get_user_by( 'id', $user_id );
     1063            if ( ! $user ) {
     1064                continue;
     1065            }
     1066
    10631067            $user->comments_number = $comment_number;
    10641068            $commenters[]          = $user;
     
    10941098                $tabs = "\t\t";
    10951099            }
    1096             $url             = 'https://profiles.wordpress.org/' . sanitize_title_with_dashes( $commenter->user_login );
     1100            $url             = 'https://profiles.wordpress.org/' . $commenter->user_nicename . '/';
    10971101            $comments_number = number_format_i18n( $commenter->comments_number );
    10981102            $code           .= " - {$commenter->user_login}: {$tabs} {$comments_number} comments. Profile: {$url}" . PHP_EOL;
Note: See TracChangeset for help on using the changeset viewer.