WordPress.org

Making WordPress.org


Ignore:
Timestamp:
04/09/2017 08:17:56 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Remove 'Trash' from reply statuses, add 'Archived' status instead.

Fixes #2556.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php

    r5294 r5299  
    2525        // Archived post status.
    2626        add_action( 'bbp_register_post_statuses',       array( $this, 'register_post_statuses' ) );
     27        add_filter( 'bbp_get_reply_statuses',           array( $this, 'get_reply_statuses' ), 10, 2 );
    2728        add_action( 'bbp_get_request',                  array( $this, 'archive_handler' ) );
    2829        add_filter( 'bbp_after_has_topics_parse_args',  array( $this, 'add_post_status_to_query' ) );
     
    151152    }
    152153
     154    /**
     155     * Remove 'Trash' from reply statuses, add 'Archived' status instead.
     156     *
     157     * @param array $r        Reply statuses array.
     158     * @param int   $reply_id Reply ID.
     159     * @return array Filtered reply statuses array.
     160     */
     161    public function get_reply_statuses( $r, $reply_id ) {
     162        /*
     163         * Remove 'Trash' from reply statuses. Trashing a reply will eventually permanently
     164         * delete it when the trash is emptied. Better to mark it as pending or spam.
     165         */
     166        unset( $r['trash'] );
     167
     168        $r[ self::ARCHIVED ] = _x( 'Archived', 'post', 'wporg-forums' );
     169
     170        return $r;
     171    }
     172
    153173    public function archive_handler( $action = '' ) {
    154174        if ( ! in_array( $action, $this->get_valid_actions() ) ) {
Note: See TracChangeset for help on using the changeset viewer.