| 196 | /** |
| 197 | * Display a notice for messages caught in the moderation queue. |
| 198 | */ |
| 199 | function wporg_support_add_moderation_notice() { |
| 200 | $post_time = mysql2date( 'U', get_post_field( 'post_date', get_the_ID() ) ); |
| 201 | $seconds_passed = current_time( 'timestamp' ) - $post_time; |
| 202 | $hours_passed = (int) ( $seconds_passed / HOUR_IN_SECONDS ); |
| 203 | $is_user_blocked = ! current_user_can( 'spectate' ); |
| 204 | ?> |
| 205 | |
| 206 | <?php if ( in_array( get_post_status(), array( 'pending', 'spam' ) ) ) : ?> |
| 207 | |
| 208 | <div class="bbp-template-notice"> |
| 209 | <p><?php _e( 'This post has been held for moderation by our automated system. It will be reviewed within 72 hours.', 'wporg-forums' ); ?></p> |
| 210 | </div> |
| 211 | |
| 212 | <?php if ( ! $is_user_blocked && $hours_passed > 96 ) : ?> |
| 213 | |
| 214 | <div class="bbp-template-notice warning"> |
| 215 | <p><?php |
| 216 | printf( |
| 217 | /* translators: https://make.wordpress.org/chat/ */ |
| 218 | __( 'If this message is not yet 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' ), |
| 219 | 'https://make.wordpress.org/chat/' |
| 220 | ); |
| 221 | ?></p> |
| 222 | </div> |
| 223 | |
| 224 | <?php endif; ?> |
| 225 | |
| 226 | <?php endif; ?> |
| 227 | |
| 228 | <?php |
| 229 | } |
| 230 | add_action( 'bbp_theme_before_topic_content', 'wporg_support_add_moderation_notice' ); |
| 231 | add_action( 'bbp_theme_before_reply_content', 'wporg_support_add_moderation_notice' ); |
| 232 | |