Making WordPress.org


Ignore:
Timestamp:
03/07/2024 06:39:00 AM (13 months ago)
Author:
akirk
Message:

Translate Events: add languages and contributors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats-listener.php

    r13279 r13298  
    2626            function ( $translation ) {
    2727                $happened_at = DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s', $translation->date_added, new DateTimeZone( 'UTC' ) );
     28                if ( ! $translation->user_id ) {
     29                    return;
     30                }
    2831                $this->handle_action( $translation, $translation->user_id, self::ACTION_CREATE, $happened_at );
    2932            },
     
    5558                }
    5659
    57                 if ( $action ) {
     60                if ( $action && $user_id ) {
    5861                    $this->handle_action( $translation, $user_id, $action, $happened_at );
    5962                }
     
    6669    private function handle_action( GP_Translation $translation, int $user_id, string $action, DateTimeImmutable $happened_at ): void {
    6770        try {
    68             if ( ! $user_id ) {
    69                 return;
    70             }
    7171            // Get events that are active when the action happened, for which the user is registered for.
    7272            $active_events = $this->get_active_events( $happened_at );
     
    172172    // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found
    173173    private function select_events_user_is_registered_for( array $events, int $user_id ): array {
    174         $attending_event_ids = get_user_meta( $user_id, Route::USER_META_KEY_ATTENDING, true );
     174        $attending_event_ids = get_user_meta( $user_id, Translation_Events::USER_META_KEY_ATTENDING, true );
    175175        return array_filter(
    176176            $events,
Note: See TracChangeset for help on using the changeset viewer.