Changeset 7278
- Timestamp:
- 07/02/2024 06:19:31 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/classes/class-bbp-admin.php
r7268 r7278 219 219 // Allow keymasters to save forums settings 220 220 add_filter( 'option_page_capability_bbpress', array( $this, 'option_page_capability_bbpress' ) ); 221 222 // Maybe add post-state support for Forum & Topic Archive pages 223 add_filter( 'display_post_states', array( $this, 'display_post_states' ), 10, 2 ); 221 224 222 225 /** Network Admin *****************************************************/ … … 908 911 $capability = $this->minimum_capability; 909 912 return $capability; 913 } 914 915 /** 916 * Add post-state support for shortcode usages. 917 * 918 * Also does a quick slug comparison, to avoid doing many get_page_by_path() 919 * calls inside of a list-table loop. This is less precise but should work 920 * well-enough for most installations. 921 * 922 * @since 2.7.0 923 * 924 * @param array $post_states 925 * @param int|WP_Post $post 926 * 927 * @return array 928 */ 929 public function display_post_states( $post_states = array(), $post = 0 ) { 930 931 // Default return value 932 $retval = $post_states; 933 934 /** Shortcodes ********************************************************/ 935 936 // Forum Archive 937 if ( has_shortcode( $post->post_content, 'bbp-forum-index' ) ) { 938 $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' ); 939 940 // Topic Archive 941 } elseif ( has_shortcode( $post->post_content, 'bbp-topic-index' ) ) { 942 $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' ); 943 944 // Topic Tags 945 } elseif ( has_shortcode( $post->post_content, 'bbp-topic-tags' ) ) { 946 $retval[] = esc_html_x( 'Topic Tags', 'page label', 'bbpress' ); 947 948 // Topic View 949 } elseif ( has_shortcode( $post->post_content, 'bbp-single-view' ) ) { 950 $retval[] = esc_html_x( 'Topic View', 'page label', 'bbpress' ); 951 952 // Search 953 } elseif ( has_shortcode( $post->post_content, 'bbp-search' ) ) { 954 $retval[] = esc_html_x( 'Forum Search', 'page label', 'bbpress' ); 955 956 // Login 957 } elseif ( has_shortcode( $post->post_content, 'bbp-login' ) ) { 958 $retval[] = esc_html_x( 'Forum Login', 'page label', 'bbpress' ); 959 960 // Register 961 } elseif ( has_shortcode( $post->post_content, 'bbp-register' ) ) { 962 $retval[] = esc_html_x( 'Forum Registration', 'page label', 'bbpress' ); 963 964 // Lost Password 965 } elseif ( has_shortcode( $post->post_content, 'bbp-lost-pass' ) ) { 966 $retval[] = esc_html_x( 'Forum Lost Password', 'page label', 'bbpress' ); 967 968 // Statistics 969 } elseif ( has_shortcode( $post->post_content, 'bbp-stats' ) ) { 970 $retval[] = esc_html_x( 'Forum Statistics', 'page label', 'bbpress' ); 971 972 /** Paths *************************************************************/ 973 974 // Forum Archive 975 } elseif ( $post->post_name === bbp_get_root_slug() ) { 976 $retval[] = esc_html_x( 'Forum Archive', 'page label', 'bbpress' ); 977 978 // Topic Archive 979 } elseif ( $post->post_name === bbp_get_topic_archive_slug() ) { 980 $retval[] = esc_html_x( 'Topic Archive', 'page label', 'bbpress' ); 981 } 982 983 // Return possibly modified post states 984 return $retval; 910 985 } 911 986
Note: See TracChangeset
for help on using the changeset viewer.