WordPress.org

Making WordPress.org

Changeset 3703


Ignore:
Timestamp:
07/21/2016 01:32:40 PM (3 years ago)
Author:
jmdodd
Message:

Support: Change the topic title when it is resolved in Topic Resolution plugin.

See #1544.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-resolution/inc/class-plugin.php

    r3666 r3703  
    4242     */
    4343    public function bbp_loaded() {
    44         // Display the form depending on context
     44        // Change the topic title when resolved.
     45        add_filter( 'bbp_get_topic_title', array( $this, 'get_topic_title' ), 10, 2 );
     46
     47        // Display the form for new/edited topics.
    4548        add_action( 'bbp_theme_before_topic_form_content', array( $this, 'form_topic_resolution_dropdown' ) );
    4649        add_action( 'bbp_theme_before_topic_form_subscriptions', array( $this, 'form_topic_resolution_checkbox' ) );
    4750
    48         // Process field submission
     51        // Process field submission for topics.
    4952        add_action( 'bbp_new_topic_post_extras', array( $this, 'topic_post_extras' ) );
    5053        add_action( 'bbp_edit_topic_post_extras', array( $this, 'topic_post_extras' ) );
    5154
    52         // Admin interface for enabling on forums
     55        // Indicate if the forum is a support forum.
    5356        add_filter( 'manage_forum_posts_columns', array( $this, 'add_forum_topic_resolution_column' ), 11 );
    5457        add_action( 'manage_forum_posts_custom_column', array( $this, 'add_forum_topic_resolution_value' ), 10, 2 );
     
    5659        // Process field submission
    5760        // @todo Bulk actions aren't filterable, so this might be hacky.
     61    }
     62
     63    /**
     64     * Add "Resolved" status to title.
     65     */
     66    public function get_topic_title( $title, $topic_id ) {
     67        $resolved = __( 'Resolved', 'wporg' );
     68        if ( 'yes' == $this->get_topic_resolution( array( 'id' => $topic_id ) ) ) {
     69           return sprintf( esc_html( '[%s]: %s' ), $resolved, $title );
     70        }
     71        return $title;
    5872    }
    5973
Note: See TracChangeset for help on using the changeset viewer.