Making WordPress.org

Ticket #2474: meta-2474.patch

File meta-2474.patch, 3.8 KB (added by SergeyBiryukov, 8 years ago)
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php

     
    3232
    3333                // Limit no-replies view to certain number of days.
    3434                add_filter( 'bbp_register_view_no_replies', array( $this, 'limit_no_replies_view' ) );
     35
     36                // Store moderator's username on approve/unapprove actions.
     37                add_action( 'bbp_approved_topic',   array( $this, 'store_moderator_username' ) );
     38                add_action( 'bbp_approved_reply',   array( $this, 'store_moderator_username' ) );
     39                add_action( 'bbp_unapproved_topic', array( $this, 'store_moderator_username' ) );
     40                add_action( 'bbp_unapproved_reply', array( $this, 'store_moderator_username' ) );
    3541        }
    3642
    3743        /**
     
    173179                return $args;
    174180        }
    175181
     182        /**
     183         * Store moderator's username on approve/unapprove actions.
     184         *
     185         * @param int $post_id Post ID.
     186         */
     187        public function store_moderator_username( $post_id ) {
     188                update_post_meta( $post_id, '_wporg_bbp_moderator', wp_get_current_user()->user_login );
     189        }
     190
    176191}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php

     
    66
    77        const ARCHIVED       = 'archived';
    88        const ARCHIVED_META  = '_wporg_bbp_unarchived_post_status';
     9        const MODERATOR_META = '_wporg_bbp_moderator';
    910        const DEFAULT_STATUS = 'publish';
    1011        const VIEWS          = array( 'archived', 'pending', 'spam' );
    1112
     
    248249                        ), true );
    249250                        if ( $post_id ) {
    250251                                update_post_meta( $post->ID, self::ARCHIVED_META, $post->post_status );
     252                                update_post_meta( $post->ID, self::MODERATOR_META, wp_get_current_user()->user_login );
    251253                                return true;
    252254                        }
    253255                }
     
    276278                        ) );
    277279                        if ( $post_id ) {
    278280                                delete_post_meta( $post->ID, self::ARCHIVED_META );
     281                                update_post_meta( $post->ID, self::MODERATOR_META, wp_get_current_user()->user_login );
    279282                                return true;
    280283                        }
    281284                }
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

     
    251251                                $notice = __( 'This post has been flagged as spam.', 'wporg-forums' );
    252252                        }
    253253                } elseif ( 'archived' === $post_status ) {
    254                         $notice = __( 'This post is currently archived.', 'wporg-forums' );
     254                        $moderator = get_post_meta( get_the_ID(), '_wporg_bbp_moderator', true );
     255
     256                        if ( $moderator ) {
     257                                /* translators: %s: moderator's username */
     258                                $notice = sprintf( __( 'This post has been archived by %s.', 'wporg-forums' ), $moderator );
     259                        } else {
     260                                $notice = __( 'This post is currently archived.', 'wporg-forums' );
     261                        }
    255262                } else {
    256                         $notice = __( 'This post is currently pending.', 'wporg-forums' );
     263                        $moderator = get_post_meta( get_the_ID(), '_wporg_bbp_moderator', true );
     264
     265                        if ( $moderator ) {
     266                                /* translators: %s: moderator's username */
     267                                $notice = sprintf( __( 'This post has been unapproved by %s.', 'wporg-forums' ), $moderator );
     268                        } else {
     269                                $notice = __( 'This post is currently pending.', 'wporg-forums' );
     270                        }
    257271                }
    258272
    259273        elseif ( in_array( $post_status, array( 'pending', 'spam' ) ) ) :