From aecac300ce30c132c88d1165bf3b2b45de480b19 Mon Sep 17 00:00:00 2001 From: Paul Kevan <2290623+pkevan@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:37:53 +0100 Subject: [PATCH] Update reports.php (#272) Make use of new usermeta `last_activity_tracker` to more accurately see when a user had an interaction. This should allow more accurate reporting, since last login can sometime be very old. --- plugins/wporg-5ftf/includes/reports.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/plugins/wporg-5ftf/includes/reports.php b/plugins/wporg-5ftf/includes/reports.php index 4032170..0b98bea 100644 --- a/plugins/wporg-5ftf/includes/reports.php +++ b/plugins/wporg-5ftf/includes/reports.php @@ -211,7 +211,7 @@ function render_contributor_report_page() { Teams Full Name Email - Last login + Last activity (log in or tracked activity) Status display_name ?? ''; $user_email = $user->user_email ?? ''; $last_login = get_user_meta( $user_id, 'last_logged_in', true ); + $last_activity = get_user_meta( $user_id, 'last_activity_tracker', true ); $teams = str_replace( ' Team', '', implode( ',', $xprofile_teams ) ); echo ''; echo '' . absint( $user_id ) . ''; @@ -238,7 +239,14 @@ function render_contributor_report_page() { echo '' . esc_html( $teams ) . ''; echo '' . esc_html( $user_display_name ) . ''; echo '' . esc_html( $user_email ) . ''; - echo '' . esc_html( $last_login ) . ''; + + // Either output last activity or last login. + if ( $last_activity > $last_login ) { + echo '' . esc_html( $last_activity ) . ''; + } else { + echo '' . esc_html( $last_login ) . ''; + } + echo '' . esc_html( $c->post_status ) . ''; echo ''; $export_data[] = array( $user_id, $c->post_title, $pledge_company_title, $xprofile['hours_per_week'], $teams, $user_display_name, $user_email, $last_login, $c->post_status );