Making WordPress.org

Changeset 5003


Ignore:
Timestamp:
02/24/2017 07:36:00 PM (8 years ago)
Author:
coffee2code
Message:

Support Theme: For user profiles, spam/pending views, and single topic views, indicate moderator who flagged a user.

Props SergeyBiryukov.
Fixes #2493.

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

    r4701 r5003  
    1212<div id="bbp-user-profile" class="bbp-user-profile">
    1313    <h2 class="entry-title"><?php esc_html_e( 'Profile', 'wporg-forums' ); ?></h2>
    14     <div class="bbp-user-section">
     14    <div class="bbp-user-section"><?php
     15        if ( class_exists( 'WordPressdotorg\Forums\User_Moderation\Plugin' ) ) {
     16            $is_user_flagged = WordPressdotorg\Forums\User_Moderation\Plugin::get_instance()->is_user_flagged( bbp_get_displayed_user_id() );
     17            $moderator       = get_user_meta( bbp_get_displayed_user_id(), '_wporg_bbp_moderator', true );
     18
     19            if ( $is_user_flagged && $moderator ) {
     20                printf(
     21                    '<div class="bbp-template-notice info"><p>%s</p></div>',
     22                    /* translators: %s: moderator's username */
     23                    sprintf( __( 'This user has been flagged by %s.', 'wporg-forums' ), $moderator )
     24                );
     25            }
     26        }
     27        ?>
    1528
    1629        <?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?>
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r4988 r5003  
    236236    $is_user_blocked = ! current_user_can( 'spectate' );
    237237    $notice_class    = '';
    238     $notice          = '';
     238    $notices         = array();
    239239
    240240    if ( $is_moderator && in_array( $post_status, array( 'archived', 'pending', 'spam' ) ) ) :
     
    247247            if ( $reporter ) {
    248248                /* translators: %s: reporter's username */
    249                 $notice = sprintf( __( 'This post has been flagged as spam by %s.', 'wporg-forums' ), $reporter );
     249                $notices[] = sprintf( __( 'This post has been flagged as spam by %s.', 'wporg-forums' ), $reporter );
    250250            } else {
    251                 $notice = __( 'This post has been flagged as spam.', 'wporg-forums' );
     251                $notices[] = __( 'This post has been flagged as spam.', 'wporg-forums' );
    252252            }
    253253        } elseif ( 'archived' === $post_status ) {
     
    256256            if ( $moderator ) {
    257257                /* translators: %s: moderator's username */
    258                 $notice = sprintf( __( 'This post has been archived by %s.', 'wporg-forums' ), $moderator );
     258                $notices[] = sprintf( __( 'This post has been archived by %s.', 'wporg-forums' ), $moderator );
    259259            } else {
    260                 $notice = __( 'This post is currently archived.', 'wporg-forums' );
     260                $notices[] = __( 'This post is currently archived.', 'wporg-forums' );
    261261            }
    262262        } else {
     
    265265            if ( $moderator ) {
    266266                /* translators: %s: moderator's username */
    267                 $notice = sprintf( __( 'This post has been unapproved by %s.', 'wporg-forums' ), $moderator );
     267                $notices[] = sprintf( __( 'This post has been unapproved by %s.', 'wporg-forums' ), $moderator );
    268268            } else {
    269                 $notice = __( 'This post is currently pending.', 'wporg-forums' );
     269                $notices[] = __( 'This post is currently pending.', 'wporg-forums' );
    270270            }
    271271        }
    272272
     273        if ( class_exists( 'WordPressdotorg\Forums\User_Moderation\Plugin' ) ) :
     274            $is_user_flagged = WordPressdotorg\Forums\User_Moderation\Plugin::get_instance()->is_user_flagged( get_post()->post_author );
     275            $moderator       = get_user_meta( get_post()->post_author, '_wporg_bbp_moderator', true );
     276
     277            if ( $is_user_flagged && $moderator ) {
     278                /* translators: %s: moderator's username */
     279                $notices[] = sprintf( __( 'This user has been flagged by %s.', 'wporg-forums' ), $moderator );
     280            }
     281        endif;
     282
    273283    elseif ( in_array( $post_status, array( 'pending', 'spam' ) ) ) :
    274284
    275285        if ( $is_user_blocked ) {
    276286            // Blocked users get a generic message with no call to action or moderation timeframe.
    277             $notice = __( 'This post has been held for moderation by our automated system.', 'wporg-forums' );
     287            $notices[] = __( 'This post has been held for moderation by our automated system.', 'wporg-forums' );
    278288        } elseif ( $hours_passed > 96 ) {
    279289            $notice_class = 'warning';
    280             $notice       = sprintf(
     290            $notices[]    = sprintf(
    281291                /* translators: %s: https://make.wordpress.org/chat/ */
    282292                __( 'This post was held for moderation by our automated system but has taken longer than expected to get approved. Please come to the #forums channel on <a href="%s">WordPress Slack</a> and let us know. Provide a link to the post.', 'wporg-forums' ),
     
    284294            );
    285295        } else {
    286             $notice = sprintf(
     296            $notices[] = sprintf(
    287297                /* translators: %d: number of hours */
    288298                _n( 'This post has been held for moderation by our automated system. It will be reviewed within %d hour.', 'This post has been held for moderation by our automated system. It will be reviewed within %d hours.', 72, 'wporg-forums' ),
     
    293303    endif;
    294304
    295     if ( $notice ) {
     305    if ( $notices ) {
    296306        printf(
    297307            '<div class="bbp-template-notice %s"><p>%s</p></div>',
    298308            esc_attr( $notice_class ),
    299             $notice
     309            implode( '</p><p>', $notices )
    300310        );
    301311    }
Note: See TracChangeset for help on using the changeset viewer.