Making WordPress.org


Ignore:
Timestamp:
05/13/2019 05:49:46 AM (5 years ago)
Author:
tellyworth
Message:

Translation Teams: show current and past contributors separately.

See #2320.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wp-i18n-teams/wp-i18n-teams.php

    r7829 r8781  
    282282        $locale_data['project_validators'] = $contributors['project_validators'];
    283283        $locale_data['translators'] = $contributors['translators'];
     284        $locale_data['translators_past'] = $contributors['translators_past'];
    284285
    285286        return $locale_data;
     
    302303        $contributors['validators'] = $this->get_general_translation_editors( $locale );
    303304        $contributors['project_validators'] = $this->get_project_translation_editors( $locale );
    304         $contributors['translators'] = $this->get_translation_contributors( $locale );
     305        $contributors['translators'] = $this->get_translation_contributors( $locale, 365 ); // Contributors from the past year
     306        $contributors['translators_past'] = array_diff_key( $this->get_translation_contributors( $locale ), $contributors['translators'] );
    305307
    306308        wp_cache_set( 'contributors-data:' . $locale->wp_locale, $contributors, 'wp-i18n-teams', 2 * HOUR_IN_SECONDS );
     
    478480     * @return array
    479481     */
    480     private function get_translation_contributors( $locale ) {
     482    private function get_translation_contributors( $locale, $max_age_days = null ) {
    481483        global $wpdb;
    482484
    483485        $contributors = array();
     486
     487        $date_constraint = '';
     488        if ( !is_null( $max_age_days ) )
     489            $date_constraint = $wpdb->prepare( " AND date_modified >= CURRENT_DATE - INTERVAL %d DAY", $max_age_days );
    484490
    485491        $users = $wpdb->get_col( $wpdb->prepare(
    486492            "SELECT DISTINCT user_id FROM translate_user_translations_count WHERE accepted > 0 AND locale = %s",
    487493            $locale->slug
    488         ) );
     494        ) . $date_constraint );
    489495
    490496        if ( ! $users ) {
Note: See TracChangeset for help on using the changeset viewer.