Changeset 13298 for sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-translation-events/includes/stats-listener.php
- Timestamp:
- 03/07/2024 06:39:00 AM (13 months ago)
- 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 26 26 function ( $translation ) { 27 27 $happened_at = DateTimeImmutable::createFromFormat( 'Y-m-d H:i:s', $translation->date_added, new DateTimeZone( 'UTC' ) ); 28 if ( ! $translation->user_id ) { 29 return; 30 } 28 31 $this->handle_action( $translation, $translation->user_id, self::ACTION_CREATE, $happened_at ); 29 32 }, … … 55 58 } 56 59 57 if ( $action ) {60 if ( $action && $user_id ) { 58 61 $this->handle_action( $translation, $user_id, $action, $happened_at ); 59 62 } … … 66 69 private function handle_action( GP_Translation $translation, int $user_id, string $action, DateTimeImmutable $happened_at ): void { 67 70 try { 68 if ( ! $user_id ) {69 return;70 }71 71 // Get events that are active when the action happened, for which the user is registered for. 72 72 $active_events = $this->get_active_events( $happened_at ); … … 172 172 // phpcs:disable Generic.CodeAnalysis.UnusedFunctionParameter.Found 173 173 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 ); 175 175 return array_filter( 176 176 $events,
Note: See TracChangeset
for help on using the changeset viewer.