Making WordPress.org

Changeset 5158


Ignore:
Timestamp:
03/21/2017 07:33:38 PM (7 years ago)
Author:
coffee2code
Message:

Support Theme: Display date and time in user profile and moderation admin notices of when a user was flagged.

Props SergeyBiryukov.
Fixes #2584.

Location:
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-profile.php

    r5051 r5158  
    1616            $is_user_flagged = WordPressdotorg\Forums\User_Moderation\Plugin::get_instance()->is_user_flagged( bbp_get_displayed_user_id() );
    1717            $moderator       = get_user_meta( bbp_get_displayed_user_id(), WordPressdotorg\Forums\User_Moderation\Plugin::MODERATOR_META, true );
     18            $moderation_date = get_user_meta( bbp_get_displayed_user_id(), WordPressdotorg\Forums\User_Moderation\Plugin::MODERATION_DATE_META, true );
    1819
    1920            if ( $is_user_flagged ) {
    20                 if ( $moderator ) {
     21                if ( $moderator && $moderation_date ) {
     22                    $msg = sprintf(
     23                        /* translators: 1: linked moderator's username, 2: moderation date, 3: moderation time */
     24                        __( 'This user has been flagged by %1$s on %2$s at %3$s.', 'wporg-forums' ),
     25                        sprintf( '<a href="%s">%s</a>', esc_url( home_url( "/users/$moderator/" ) ), $moderator ),
     26                        /* translators: localized date format, see https://secure.php.net/date */
     27                        mysql2date( __( 'F j, Y', 'wporg-forums' ), $moderation_date ),
     28                        /* translators: localized time format, see https://secure.php.net/date */
     29                        mysql2date( __( 'g:i a', 'wporg-forums' ), $moderation_date )
     30                    );
     31                } elseif ( $moderator ) {
    2132                    $msg = sprintf(
    2233                        /* translators: %s: linked moderator's username */
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r5141 r5158  
    310310            $is_user_flagged = WordPressdotorg\Forums\User_Moderation\Plugin::get_instance()->is_user_flagged( get_post()->post_author );
    311311            $moderator       = get_user_meta( get_post()->post_author, WordPressdotorg\Forums\User_Moderation\Plugin::MODERATOR_META, true );
     312            $moderation_date = get_user_meta( get_post()->post_author, WordPressdotorg\Forums\User_Moderation\Plugin::MODERATION_DATE_META, true );
    312313
    313314            if ( $is_user_flagged ) {
    314                 if ( $moderator ) {
     315                if ( $moderator && $moderation_date ) {
     316                    $notices[] = sprintf(
     317                        /* translators: 1: linked moderator's username, 2: moderation date, 3: moderation time */
     318                        __( 'This user has been flagged by %1$s on %2$s.', 'wporg-forums' ),
     319                        sprintf( '<a href="%s">%s</a>', esc_url( home_url( "/users/$moderator/" ) ), $moderator ),
     320                        /* translators: localized date format, see https://secure.php.net/date */
     321                        mysql2date( __( 'F j, Y', 'wporg-forums' ), $moderation_date ),
     322                        /* translators: localized time format, see https://secure.php.net/date */
     323                        mysql2date( __( 'g:i a', 'wporg-forums' ), $moderation_date )
     324                    );
     325                } elseif ( $moderator ) {
    315326                    $notices[] = sprintf(
    316327                        /* translators: %s: linked moderator's username */
Note: See TracChangeset for help on using the changeset viewer.