Making WordPress.org

Changeset 4987


Ignore:
Timestamp:
02/22/2017 08:11:40 PM (8 years ago)
Author:
SergeyBiryukov
Message:

Support Forums: Store moderator's username on approve/unapprove and archive/unarchive actions.

See #2474.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc
Files:
2 edited

Legend:

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

    r4974 r4987  
    4040        add_action( 'bbp_new_reply',  array( $this, 'handle_extra_reply_actions' ), 10, 2 );
    4141        add_action( 'bbp_edit_reply', array( $this, 'handle_extra_reply_actions' ), 10, 2 );
     42
     43        // Store moderator's username on approve/unapprove actions.
     44        add_action( 'bbp_approved_topic',   array( $this, 'store_moderator_username' ) );
     45        add_action( 'bbp_approved_reply',   array( $this, 'store_moderator_username' ) );
     46        add_action( 'bbp_unapproved_topic', array( $this, 'store_moderator_username' ) );
     47        add_action( 'bbp_unapproved_reply', array( $this, 'store_moderator_username' ) );
    4248    }
    4349
     
    267273    }
    268274
     275    /**
     276     * Store moderator's username on approve/unapprove actions.
     277     *
     278     * @param int $post_id Post ID.
     279     */
     280    public function store_moderator_username( $post_id ) {
     281        update_post_meta( $post_id, '_wporg_bbp_moderator', wp_get_current_user()->user_login );
     282    }
     283
    269284}
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-moderators.php

    r4232 r4987  
    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' );
     
    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            }
     
    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            }
Note: See TracChangeset for help on using the changeset viewer.