Ticket #2493: meta-2493.2.patch
File meta-2493.2.patch, 6.8 KB (added by , 8 years ago) |
---|
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-user-moderation/inc/class-plugin.php
19 19 // Back-compat user option name. 20 20 const USER_META = 'is_bozo'; 21 21 22 // Meta key to store moderator's username on flag/unflag actions. 23 const MODERATOR_META = '_wporg_bbp_moderator'; 24 22 25 /** 23 26 * Always return the same instance of this plugin. 24 27 * … … 228 231 229 232 if ( ! $this->is_user_flagged( $user_id ) ) { 230 233 update_user_meta( $user_id, self::USER_META, true ); 234 update_user_meta( $user_id, self::MODERATOR_META, wp_get_current_user()->user_login ); 231 235 } 232 236 do_action( 'wporg_bbp_flag_user', $user_id ); 233 237 … … 241 245 242 246 if ( $this->is_user_flagged( $user_id ) ) { 243 247 delete_user_meta( $user_id, self::USER_META ); 248 update_user_meta( $user_id, self::MODERATOR_META, wp_get_current_user()->user_login ); 244 249 } 245 250 do_action( 'wporg_bbp_unflag_user', $user_id ); 246 251 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/bbpress/user-profile.php
11 11 12 12 <div id="bbp-user-profile" class="bbp-user-profile"> 13 13 <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 ); 15 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 ?> 28 16 29 <?php if ( bbp_get_displayed_user_field( 'description' ) ) : ?> 17 30 18 31 <p class="bbp-user-description"><?php bbp_displayed_user_field( 'description' ); ?></p> -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php
235 235 $is_moderator = current_user_can( 'moderate' ); 236 236 $is_user_blocked = ! current_user_can( 'spectate' ); 237 237 $notice_class = ''; 238 $notice = '';238 $notices = array(); 239 239 240 240 if ( $is_moderator && in_array( $post_status, array( 'archived', 'pending', 'spam' ) ) ) : 241 241 … … 246 246 247 247 if ( $reporter ) { 248 248 /* 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 ); 250 250 } else { 251 $notice = __( 'This post has been flagged as spam.', 'wporg-forums' );251 $notices[] = __( 'This post has been flagged as spam.', 'wporg-forums' ); 252 252 } 253 253 } elseif ( 'archived' === $post_status ) { 254 254 $moderator = get_post_meta( get_the_ID(), '_wporg_bbp_moderator', true ); … … 255 255 256 256 if ( $moderator ) { 257 257 /* 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 ); 259 259 } else { 260 $notice = __( 'This post is currently archived.', 'wporg-forums' );260 $notices[] = __( 'This post is currently archived.', 'wporg-forums' ); 261 261 } 262 262 } else { 263 263 $moderator = get_post_meta( get_the_ID(), '_wporg_bbp_moderator', true ); … … 264 264 265 265 if ( $moderator ) { 266 266 /* 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 ); 268 268 } else { 269 $notice = __( 'This post is currently pending.', 'wporg-forums' );269 $notices[] = __( 'This post is currently pending.', 'wporg-forums' ); 270 270 } 271 271 } 272 272 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 273 283 elseif ( in_array( $post_status, array( 'pending', 'spam' ) ) ) : 274 284 275 285 if ( $is_user_blocked ) { 276 286 // 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' ); 278 288 } elseif ( $hours_passed > 96 ) { 279 289 $notice_class = 'warning'; 280 $notice 290 $notices[] = sprintf( 281 291 /* translators: %s: https://make.wordpress.org/chat/ */ 282 292 __( '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' ), 283 293 'https://make.wordpress.org/chat/' 284 294 ); 285 295 } else { 286 $notice = sprintf(296 $notices[] = sprintf( 287 297 /* translators: %d: number of hours */ 288 298 _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' ), 289 299 72 … … 292 302 293 303 endif; 294 304 295 if ( $notice ) {305 if ( $notices ) { 296 306 printf( 297 307 '<div class="bbp-template-notice %s"><p>%s</p></div>', 298 308 esc_attr( $notice_class ), 299 $notice309 implode( '</p><p>', $notices ) 300 310 ); 301 311 } 302 312 }