Changeset 12860
- Timestamp:
- 08/24/2023 05:54:28 PM (18 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/support-forums/inc/class-hooks.php
r12810 r12860 76 76 add_filter( 'bbp_register_view_no_replies', array( $this, 'limit_no_replies_view' ) ); 77 77 78 // Allow topics with the OP adding more details to show up in no-replies view. 79 add_filter( 'bbp_register_view_no_replies', array( $this, 'make_no_replies_consider_voices' ), 20 ); 80 78 81 // Remove the description from the CPT to avoid Jetpack using it as the og:description. 79 82 add_filter( 'bbp_register_forum_post_type', array( $this, 'bbp_register_forum_post_type' ) ); … … 333 336 * - /users/$id & /profile/$slug to /users/$slug 334 337 * - /users/profile/* => /users/$slug/* 335 * 338 * 336 339 * See also: Support_Compat in inc/class-support-compat.php 337 340 */ … … 627 630 if ( bbp_is_single_topic() ) { 628 631 $topic_id = bbp_get_topic_id(); 629 632 630 633 // Prepend label if thread is closed. 631 634 if ( bbp_is_topic_closed( $topic_id ) ) { … … 931 934 932 935 /** 936 * Modifies the No Replies view to look at the amount of voices instead of replies. 937 * 938 * This allows a topic OP to provide additional details without their topic 939 * going away from the No Replies view. 940 * 941 * @param array $args Array of query args for the view. 942 * @return array 943 */ 944 public function make_no_replies_consider_voices( $args ) { 945 /* 946 * Remove the default view arguments, in favor of a new meta_query instead. 947 * Looping over an array of defined keys allows us to be forward compatible 948 * if bbPress implements meta queries in the future. 949 */ 950 $default_keys = array( 'meta_key', 'meta_type', 'meta_value', 'meta_compare' ); 951 foreach ( $default_keys as $key ) { 952 if ( isset( $args[ $key ] ) ) { 953 unset( $args[ $key ] ); 954 } 955 } 956 957 $args['meta_query'][] = array( 958 'key' => '_bbp_voice_count', 959 'type' => 'NUMERIC', 960 'value' => 2, 961 'compare' => '<', 962 ); 963 964 return $args; 965 } 966 967 /** 933 968 * Remove the Forum CPT description field to prevent Jetpack using it as the og:description on /forums/. 934 969 */ … … 1271 1306 return $content; 1272 1307 } 1273 1308 1274 1309 /** 1275 1310 * Alter the bbPress topic freshness links to use the date in the title attribute rather than thread title. … … 1304 1339 1305 1340 /** 1306 * Filter the topic subscription message to 1341 * Filter the topic subscription message to 1307 1342 */ 1308 1343 public function bbp_subscription_mail_message( $message, $reply_id, $topic_id ) {
Note: See TracChangeset
for help on using the changeset viewer.