Changeset 4639
- Timestamp:
- 01/12/2017 05:36:44 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-bbp-topic-resolution/inc/class-plugin.php
r4034 r4639 38 38 add_filter( 'bbp_get_topic_title', array( $this, 'get_topic_title' ), 10, 2 ); 39 39 40 // Add resolved indicator to single topic view. 41 add_action( 'bbp_theme_before_topic_author_details', array( $this, 'single_topic_resolved_indicator' ) ); 42 40 43 // Display the form for new/edit topics. 41 44 add_action( 'bbp_theme_before_topic_form_content', array( $this, 'form_topic_resolution_dropdown' ) ); … … 66 69 public function get_topic_title( $title, $topic_id ) { 67 70 // Only run when enabled on a topic's forum. 68 if ( ! $this->is_enabled_on_forum( bbp_get_topic_forum_id( $topic_id ) ) ) {71 if ( bbp_is_single_topic() || ! $this->is_enabled_on_forum( bbp_get_topic_forum_id( $topic_id ) ) ) { 69 72 return $title; 70 73 } 71 74 72 $resolved = __( 'Resolved', 'wporg-forums' );73 75 if ( 'yes' == $this->get_topic_resolution( array( 'id' => $topic_id ) ) ) { 74 return sprintf( '[%s] %s', esc_html( $resolved ), $title ); 75 } 76 $title = sprintf( 77 '<span class="resolved" aria-label="%s" title="%s"></span>', 78 esc_attr__( 'Resolved', 'wporg-forums' ), 79 esc_attr__( 'Topic is resolved.', 'wporg-forums' ) 80 ) . $title; 81 } 82 76 83 return $title; 84 } 85 86 /** 87 * Outputs resolved topic indicator. 88 */ 89 public function single_topic_resolved_indicator() { 90 $topic_id = bbp_get_topic_forum_id(); 91 92 if ( 93 // Must be single topic view 94 ! bbp_is_single_topic() 95 || 96 // Must be enabled on the forum 97 ! $this->is_enabled_on_forum( bbp_get_topic_forum_id( $topic_id ) ) 98 || 99 // Must be a resolved topic 100 'yes' == $this->get_topic_resolution( array( 'id' => $topic_id ) ) 101 ) { 102 return; 103 } 104 105 echo '<span class="topic-resolved-indicator">' . __( 'Answered', 'wporg-forums' ) . '</span>'; 77 106 } 78 107
Note: See TracChangeset
for help on using the changeset viewer.