Ticket #1575: 1575.1.2.diff
File 1575.1.2.diff, 27.8 KB (added by , 13 years ago) |
---|
-
bbpress.php
221 221 $this->trash_status_id = apply_filters( 'bbp_trash_post_status', 'trash' ); 222 222 223 223 // Other identifiers 224 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 225 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 226 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 227 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 228 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 229 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 230 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 224 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 225 $this->tops_id = apply_filters( 'bbp_tops_id', 'bbp_tops' ); 226 $this->reps_id = apply_filters( 'bbp_reps_id', 'bbp_reps' ); 227 $this->favs_id = apply_filters( 'bbp_favs_id', 'bbp_favs' ); 228 $this->subs_id = apply_filters( 'bbp_subs_id', 'bbp_subs' ); 229 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 230 $this->search_id = apply_filters( 'bbp_search_id', 'bbp_search' ); 231 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 231 232 232 233 /** Queries ***********************************************************/ 233 234 … … 239 240 $this->forum_query = new stdClass(); // Main forum query 240 241 $this->topic_query = new stdClass(); // Main topic query 241 242 $this->reply_query = new stdClass(); // Main reply query 243 $this->search_query = new stdClass(); // Main search query 242 244 243 245 /** Theme Compat ******************************************************/ 244 246 … … 358 360 'register_views', // Register the views (no-replies) 359 361 'register_theme_packages', // Register bundled theme packages (bbp-theme-compat/bbp-themes) 360 362 'load_textdomain', // Load textdomain (bbpress) 361 'add_rewrite_tags', // Add rewrite tags (view|user|edit )362 'generate_rewrite_rules' // Generate rewrite rules (view|edit )363 'add_rewrite_tags', // Add rewrite tags (view|user|edit|search) 364 'generate_rewrite_rules' // Generate rewrite rules (view|edit|search) 363 365 ); 364 366 365 367 // Add the actions … … 832 834 public static function add_rewrite_tags() { 833 835 add_rewrite_tag( '%%' . bbp_get_view_rewrite_id() . '%%', '([^/]+)' ); // View Page tag 834 836 add_rewrite_tag( '%%' . bbp_get_edit_rewrite_id() . '%%', '([1]{1,})' ); // Edit Page tag 837 add_rewrite_tag( '%%' . bbp_get_search_rewrite_id() . '%%', '([^/]+)' ); // Search Results tag 835 838 add_rewrite_tag( '%%' . bbp_get_user_rewrite_id() . '%%', '([^/]+)' ); // User Profile tag 836 839 add_rewrite_tag( '%%' . bbp_get_user_favorites_rewrite_id() . '%%', '([1]{1,})' ); // User Favorites tag 837 840 add_rewrite_tag( '%%' . bbp_get_user_subscriptions_rewrite_id() . '%%', '([1]{1,})' ); // User Subscriptions tag … … 853 856 public static function generate_rewrite_rules( $wp_rewrite ) { 854 857 855 858 // Slugs 856 $view_slug = bbp_get_view_slug(); 857 $user_slug = bbp_get_user_slug(); 859 $view_slug = bbp_get_view_slug(); 860 $search_slug = bbp_get_search_slug(); 861 $user_slug = bbp_get_user_slug(); 858 862 859 863 // Unique rewrite ID's 860 $edit_id = bbp_get_edit_rewrite_id(); 861 $view_id = bbp_get_view_rewrite_id(); 862 $user_id = bbp_get_user_rewrite_id(); 863 $favs_id = bbp_get_user_favorites_rewrite_id(); 864 $subs_id = bbp_get_user_subscriptions_rewrite_id(); 865 $tops_id = bbp_get_user_topics_rewrite_id(); 866 $reps_id = bbp_get_user_replies_rewrite_id(); 864 $edit_id = bbp_get_edit_rewrite_id(); 865 $view_id = bbp_get_view_rewrite_id(); 866 $search_id = bbp_get_search_rewrite_id(); 867 $user_id = bbp_get_user_rewrite_id(); 868 $favs_id = bbp_get_user_favorites_rewrite_id(); 869 $subs_id = bbp_get_user_subscriptions_rewrite_id(); 870 $tops_id = bbp_get_user_topics_rewrite_id(); 871 $reps_id = bbp_get_user_replies_rewrite_id(); 867 872 868 873 // Rewrite rule matches used repeatedly below 869 $root_rule = '/([^/]+)/?$';870 $edit_rule = '/([^/]+)/edit/?$';871 $feed_rule = '/([^/]+)/feed/?$';872 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$';874 $root_rule = '/([^/]+)/?$'; 875 $edit_rule = '/([^/]+)/edit/?$'; 876 $feed_rule = '/([^/]+)/feed/?$'; 877 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$'; 873 878 874 879 // User profile rules 875 880 $tops_rule = '/([^/]+)/topics/?$'; … … 907 912 $view_slug . $page_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 908 913 $view_slug . $feed_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&feed=' . $wp_rewrite->preg_index( 2 ), 909 914 $view_slug . $root_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ), 915 916 // Search All 917 $search_slug . $page_rule => 'index.php?' . $search_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 918 $search_slug . $root_rule => 'index.php?' . $search_id . '=' . $wp_rewrite->preg_index( 1 ), 910 919 ); 911 920 912 921 // Merge bbPress rules with existing -
includes/admin/settings.php
299 299 'callback' => 'bbp_admin_setting_callback_view_slug', 300 300 'sanitize_callback' => 'sanitize_title', 301 301 'args' => array() 302 ), 303 304 // Search slug setting 305 '_bbp_search_slug' => array( 306 'title' => __( 'Search slug', 'bbpress' ), 307 'callback' => 'bbp_admin_setting_callback_search_slug', 308 'sanitize_callback' => 'sanitize_title', 309 'args' => array() 302 310 ) 303 311 ), 304 312 … … 883 891 bbp_form_slug_conflict_check( '_bbp_view_slug', 'view' ); 884 892 } 885 893 894 /** 895 * Search slug setting field 896 * 897 * @uses bbp_form_option() To output the option value 898 */ 899 function bbp_admin_setting_callback_search_slug() { 900 ?> 901 902 <input name="_bbp_search_slug" type="text" id="_bbp_search_slug" class="regular-text code" value="<?php bbp_form_option( '_bbp_search_slug', 'search', true ); ?>"<?php bbp_maybe_admin_setting_disabled( '_bbp_search_slug' ); ?> /> 903 904 <?php 905 // Slug Check 906 bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' ); 907 } 908 886 909 /** BuddyPress ****************************************************************/ 887 910 888 911 /** -
includes/common/shortcodes.php
79 79 80 80 'bbp-single-view' => array( $this, 'display_view' ), // Single view 81 81 82 /** Search ********************************************************/ 83 84 'bbp-search' => array( $this, 'display_search' ), // Search 85 82 86 /** Account *******************************************************/ 83 87 84 88 'bbp-login' => array( $this, 'display_login' ), // Login … … 114 118 $bbp = bbpress(); 115 119 116 120 // Unset global queries 117 $bbp->forum_query = new stdClass; 118 $bbp->topic_query = new stdClass; 119 $bbp->reply_query = new stdClass; 121 $bbp->forum_query = new stdClass; 122 $bbp->topic_query = new stdClass; 123 $bbp->reply_query = new stdClass; 124 $bbp->search_query = new stdClass; 120 125 121 126 // Unset global ID's 122 127 $bbp->current_forum_id = 0; … … 602 607 return $this->end(); 603 608 } 604 609 610 /** Search ****************************************************************/ 611 612 /** 613 * Display the contents of search results in an output buffer and return to 614 * ensure that post/page contents are displayed first. 615 * 616 */ 617 public function display_search( $attr, $content = '' ) { 618 619 // Set passed attribute to $search_terms for clarity 620 $search_terms = $attr['search']; 621 622 // Start output buffer 623 $this->start( 'bbp_search' ); 624 625 // Unset globals 626 $this->unset_globals(); 627 628 // Load the search 629 bbp_search_query( array( 's' => $search_terms ) ); 630 631 // Output template 632 bbp_get_template_part( 'content', 'search' ); 633 634 // Return contents of output buffer 635 return $this->end(); 636 } 637 605 638 /** Account ***************************************************************/ 606 639 607 640 /** -
includes/common/template-tags.php
784 784 } 785 785 786 786 /** 787 * Check if current page is a search page 788 * 789 */ 790 function bbp_is_search() { 791 global $wp_query; 792 793 // Assume false 794 $retval = false; 795 796 // Check query 797 if ( !empty( $wp_query->bbp_is_search ) && ( true == $wp_query->bbp_is_search ) ) 798 $retval = true; 799 800 // Check bbp_get_search_terms 801 if ( empty( $retval ) && bbp_is_query_name( 'bbp_search' ) ) 802 $retval = true; 803 804 return (bool) apply_filters( 'bbp_is_search', $retval ); 805 } 806 807 /** 787 808 * Check if current page is an edit page 788 809 * 789 810 * @since bbPress (r3585) … … 1806 1827 return apply_filters( 'bbp_get_view_link', $url, $view ); 1807 1828 } 1808 1829 1830 /** Search ********************************************************************/ 1831 1832 /** 1833 * Output the search terms 1834 * 1835 * @param string $search_terms Optional. Search terms 1836 * @uses bbp_get_search_terms() To get the search terms 1837 */ 1838 function bbp_search_terms( $search_terms = '' ) { 1839 echo bbp_get_search_terms( $search_terms ); 1840 } 1841 1842 /** 1843 * Get the search terms 1844 * 1845 * If search terms are supplied, those are used. Otherwise check the 1846 * search rewrite id query var. 1847 * 1848 * @param string $search_terms Optional. Search terms 1849 * @uses sanitize_title() To sanitize the search terms 1850 * @uses get_query_var*( To get the search terms from query var 'bbp_search' 1851 * @return bool|string Search terms on success, false on failure 1852 */ 1853 function bbp_get_search_terms( $search_terms = '' ) { 1854 $bbp = bbpress(); 1855 1856 $search_terms = !empty( $search_terms ) ? sanitize_title( $search_terms ) : get_query_var( bbp_get_search_rewrite_id() ); 1857 1858 if ( !empty( $search_terms ) ) 1859 return $search_terms; 1860 1861 return false; 1862 } 1863 1864 /** 1865 * Output the search page title 1866 * 1867 */ 1868 function bbp_search_title() { 1869 echo bbp_get_search_title(); 1870 } 1871 1872 function bbp_get_search_title() { 1873 1874 // Get search terms 1875 $search_terms = bbp_get_search_terms(); 1876 1877 // No search terms specified 1878 if ( empty( $search_terms ) ) { 1879 return __( 'Forum Search', 'bbpress' ); 1880 1881 // Include search terms in title 1882 } else { 1883 return sprintf( __( 'Forum Search Results: %s', 'bbpress' ), esc_attr( $search_terms ) ); 1884 } 1885 } 1886 1887 /** 1888 * Output the search url 1889 * 1890 * @uses bbp_get_search_url() To get the search url 1891 */ 1892 function bbp_search_url() { 1893 echo bbp_get_search_url(); 1894 } 1895 /** 1896 * Return the search url 1897 * 1898 * @return string Search url 1899 */ 1900 function bbp_get_search_url() { 1901 global $wp_rewrite; 1902 1903 // Pretty permalinks 1904 if ( $wp_rewrite->using_permalinks() ) { 1905 $url = user_trailingslashit( trailingslashit( bbp_get_forums_url() ) . bbp_get_search_slug() ); 1906 1907 // Unpretty permalinks 1908 } else { 1909 $url = add_query_arg( array( 'bbp_search' => $search_terms ), home_url( '/' ) ); 1910 1911 } 1912 1913 $url = home_url(); 1914 1915 return apply_filters( 'bbp_get_search_link', $url ); 1916 } 1917 1918 /** 1919 * Search main query 1920 */ 1921 function bbp_has_search_results( $args = '' ) { 1922 global $wp_rewrite; 1923 1924 /** Defaults **************************************************************/ 1925 1926 // What are the default allowed statuses (based on user caps) 1927 if ( bbp_get_view_all( 'edit_others_replies' ) ) { 1928 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id() ); 1929 } else { 1930 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id() ); 1931 } 1932 1933 $default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 1934 $default_post_status = join( ',', $post_statuses ); 1935 1936 // Default query args 1937 $default = array( 1938 'post_type' => $default_post_type, // Forums, topics, and replies 1939 'post_status' => $default_post_status, // Of this status 1940 'posts_per_page' => bbp_get_replies_per_page(), // This many 1941 'paged' => bbp_get_paged(), // On this page 1942 'orderby' => 'date', // Sorted by date 1943 'order' => 'DESC', // Most recent first 1944 's' => bbp_get_search_terms(), // This is a search 1945 ); 1946 1947 /** Setup *****************************************************************/ 1948 1949 // Parse arguments against default values 1950 $r = bbp_parse_args( $args, $default, 'has_search_results' ); 1951 1952 // Get bbPress 1953 $bbp = bbpress(); 1954 1955 // Call the query 1956 $bbp->search_query = new WP_Query( $r ); 1957 1958 // Add pagination values to query object 1959 $bbp->search_query->posts_per_page = $r['posts_per_page']; 1960 $bbp->search_query->paged = $r['paged']; 1961 1962 // Never home, regardless of what parse_query says 1963 $bbp->search_query->is_home = false; 1964 1965 // Found posts 1966 if ( !$bbp->search_query->found_posts ) 1967 return false; 1968 1969 // Only add pagination is query returned results 1970 if ( (int) $bbp->search_query->found_posts && (int) $bbp->search_query->posts_per_page ) { 1971 1972 // If pretty permalinks are enabled, make our pagination pretty 1973 if ( $wp_rewrite->using_permalinks() ) { 1974 1975 // Search 1976 $base = trailingslashit( bbp_get_search_url() ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' ); 1977 1978 // Unpretty permalinks 1979 } else { 1980 $base = add_query_arg( 'paged', '%#%' ); 1981 } 1982 1983 // Add pagination to query object 1984 $bbp->search_query->pagination_links = paginate_links( 1985 apply_filters( 'bbp_search_results_pagination', array( 1986 'base' => $base, 1987 'format' => '', 1988 'total' => ceil( (int) $bbp->search_query->found_posts / (int) $r['posts_per_page'] ), 1989 'current' => (int) $bbp->search_query->paged, 1990 'prev_text' => '←', 1991 'next_text' => '→', 1992 'mid_size' => 1, 1993 'add_args' => ( bbp_get_view_all() ) ? array( 'view' => 'all' ) : false 1994 ) ) 1995 ); 1996 1997 // Remove first page from pagination 1998 if ( $wp_rewrite->using_permalinks() ) { 1999 $bbp->search_query->pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $bbp->search_query->pagination_links ); 2000 } else { 2001 $bbp->search_query->pagination_links = str_replace( '&paged=1', '', $bbp->search_query->pagination_links ); 2002 } 2003 } 2004 2005 // Return object 2006 return apply_filters( 'bbp_has_search_results', $bbp->search_query->have_posts(), $bbp->search_query ); 2007 } 2008 2009 /** 2010 * Whether there are more search results available in the loop 2011 * 2012 * @uses WP_Query bbPress::search_query::have_posts() To check if there are more 2013 * search results available 2014 * @return object Search information 2015 */ 2016 function bbp_search_results() { 2017 2018 // Put into variable to check against next 2019 $have_posts = bbpress()->search_query->have_posts(); 2020 2021 // Reset the post data when finished 2022 if ( empty( $have_posts ) ) 2023 wp_reset_postdata(); 2024 2025 return $have_posts; 2026 } 2027 2028 /** 2029 * Loads up the current search result in the loop 2030 * 2031 * @uses WP_Query bbPress::search_query::the_post() To get the current search result 2032 * @return object Search information 2033 */ 2034 function bbp_the_search_result() { 2035 $search_result = bbpress()->search_query->the_post(); 2036 2037 switch ( get_post_type() ) { 2038 case bbp_get_forum_post_type() : 2039 bbpress()->current_forum_id = get_the_ID(); 2040 break; 2041 2042 case bbp_get_topic_post_type() : 2043 bbpress()->current_topic_id = get_the_ID(); 2044 break; 2045 2046 case bbp_get_reply_post_type() : 2047 bbpress()->current_reply_id = get_the_ID(); 2048 break; 2049 2050 } 2051 2052 return $search_result; 2053 } 2054 1809 2055 /** Query *********************************************************************/ 1810 2056 1811 2057 /** … … 2368 2614 // Views 2369 2615 } elseif ( bbp_is_single_view() ) { 2370 2616 $title = sprintf( __( 'View: %s', 'bbpress' ), bbp_get_view_title() ); 2617 2618 /** Search ****************************************************************/ 2619 2620 // Search 2621 } elseif ( bbp_is_search() ) { 2622 $title = sprintf( __( 'Search: %s', 'bbpress' ), bbp_get_search_title() ); 2623 2371 2624 } 2372 2625 2373 2626 // Filter the raw title -
includes/core/functions.php
247 247 return apply_filters( 'bbp_get_view_query_args', $retval, $view ); 248 248 } 249 249 250 /** Search ********************************************************************/ 251 252 /** 253 * Run the search query 254 * 255 */ 256 function bbp_search_query( $new_args = '' ) { 257 258 $query_args = bbp_get_search_query_args(); 259 if ( empty( $query_args ) ) 260 return false; 261 262 // Merge arguments 263 if ( !empty( $new_args ) ) { 264 $new_args = bbp_parse_args( $new_args, '', 'search_query' ); 265 $query_args = array_merge( $query_args, $new_args ); 266 } 267 268 return bbp_has_search_results( $query_args ); 269 } 270 271 /** 272 * Return the search's query args 273 * 274 */ 275 function bbp_get_search_query_args() { 276 277 // Get search terms 278 $search_terms = bbp_get_search_terms(); 279 $retval = !empty( $search_terms ) ? array( 's' => $search_terms ) : false; 280 281 return apply_filters( 'bbp_get_search_query_args', $retval ); 282 } 283 250 284 /** Errors ********************************************************************/ 251 285 252 286 /** … … 435 469 } 436 470 437 471 /** 438 * Return the enique ID for all edit rewrite rules (forum|topic|reply|tag|user)472 * Return the unique ID for all edit rewrite rules (forum|topic|reply|tag|user) 439 473 * 440 474 * @since bbPress (r3762) 441 475 * @return string … … 445 479 } 446 480 447 481 /** 482 * Return the unique ID for all search rewrite rules 483 * 484 * @return string 485 */ 486 function bbp_get_search_rewrite_id() { 487 return bbpress()->search_id; 488 } 489 490 /** 448 491 * Return the unique ID for user topics rewrite rules 449 492 * 450 493 * @since bbPress (r4321) -
includes/core/options.php
79 79 /** Other Slugs *******************************************************/ 80 80 81 81 '_bbp_view_slug' => 'view', // View slug 82 '_bbp_search_slug' => 'search', // Search slug 82 83 83 84 /** Topics ************************************************************/ 84 85 … … 499 500 return apply_filters( 'bbp_get_view_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_view_slug', $default ) ); 500 501 } 501 502 503 /** 504 * Return the search slug 505 * 506 * @return string 507 */ 508 function bbp_get_search_slug( $default = 'search' ) { 509 return apply_filters( 'bbp_get_search_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_search_slug', $default ) ); 510 } 511 502 512 /** Legacy ********************************************************************/ 503 513 504 514 /** -
includes/core/template-functions.php
257 257 * If it's a reply edit, WP_Query::bbp_is_reply_edit is set to true. 258 258 * 259 259 * If it's a view page, WP_Query::bbp_is_view is set to true 260 * If it's a search page, WP_Query::bbp_is_search is set to true 260 261 * 261 262 * @since bbPress (r2688) 262 263 * … … 291 292 return; 292 293 293 294 // Get query variables 294 $bbp_view = $posts_query->get( bbp_get_view_rewrite_id() ); 295 $bbp_user = $posts_query->get( bbp_get_user_rewrite_id() ); 296 $is_edit = $posts_query->get( bbp_get_edit_rewrite_id() ); 295 $bbp_view = $posts_query->get( bbp_get_view_rewrite_id() ); 296 $bbp_search = $posts_query->get( bbp_get_search_rewrite_id() ); 297 $bbp_user = $posts_query->get( bbp_get_user_rewrite_id() ); 298 $is_edit = $posts_query->get( bbp_get_edit_rewrite_id() ); 297 299 298 300 // It is a user page - We'll also check if it is user edit 299 301 if ( !empty( $bbp_user ) ) { … … 421 423 // We are in a custom topic view 422 424 $posts_query->bbp_is_view = true; 423 425 426 // Search Page 427 } elseif ( !empty( $bbp_search ) ) { 428 429 // Check if there are search query args set 430 $search_terms = bbp_get_search_terms(); 431 if ( !empty( $search_terms ) ) 432 $posts_query->bbp_search_terms = $search_terms; 433 434 // Correct is_home variable 435 $posts_query->is_home = false; 436 437 // We are in a search query 438 $posts_query->bbp_is_search = true; 439 424 440 // Forum/Topic/Reply Edit Page 425 441 } elseif ( !empty( $is_edit ) ) { 426 442 -
includes/core/template-loader.php
30 30 * @uses bbp_get_single_user_edit_template() To get user edit template 31 31 * @uses bbp_is_single_view() To check if page is single view 32 32 * @uses bbp_get_single_view_template() To get view template 33 * @uses bbp_is_search() To check if page is search 34 * @uses bbp_get_search_template() To get search template 33 35 * @uses bbp_is_forum_edit() To check if page is forum edit 34 36 * @uses bbp_get_forum_edit_template() To get forum edit template 35 37 * @uses bbp_is_topic_merge() To check if page is topic merge … … 63 65 // Single View 64 66 elseif ( bbp_is_single_view() && ( $new_template = bbp_get_single_view_template() ) ) : 65 67 68 // Search 69 elseif ( bbp_is_search() && ( $new_template = bbp_get_search_template() ) ) : 70 66 71 // Forum edit 67 72 elseif ( bbp_is_forum_edit() && ( $new_template = bbp_get_forum_edit_template() ) ) : 68 73 … … 251 256 } 252 257 253 258 /** 259 * Get the search template 260 * 261 */ 262 function bbp_get_search_template() { 263 $templates = array( 264 'page-forum-search.php', // Single Search 265 'forum-search.php', // Search 266 ); 267 return bbp_get_query_template( 'single_search', $templates ); 268 } 269 270 /** 254 271 * Get the single forum template 255 272 * 256 273 * @since bbPress (r3922) -
includes/core/theme-compat.php
435 435 * @uses bbp_get_single_user_edit_template() To get user edit template 436 436 * @uses bbp_is_single_view() To check if page is single view 437 437 * @uses bbp_get_single_view_template() To get view template 438 * @uses bbp_is_search() To check if page is search 439 * @uses bbp_get_search_template() To get search template 438 440 * @uses bbp_is_forum_edit() To check if page is forum edit 439 441 * @uses bbp_get_forum_edit_template() To get forum edit template 440 442 * @uses bbp_is_topic_merge() To check if page is topic merge … … 591 593 'comment_status' => 'closed' 592 594 ) ); 593 595 596 /** Search ************************************************************/ 597 598 } elseif ( bbp_is_search() ) { 599 600 // Reset post 601 bbp_theme_compat_reset_post( array( 602 'ID' => 0, 603 'post_title' => bbp_get_search_title(), 604 'post_author' => 0, 605 'post_date' => 0, 606 'post_content' => '', 607 'post_type' => '', 608 'post_status' => bbp_get_public_status_id(), 609 'comment_status' => 'closed' 610 ) ); 611 594 612 /** Topic Tags ********************************************************/ 595 613 596 614 // Topic Tag Edit … … 824 842 } elseif ( bbp_is_single_view() ) { 825 843 $new_content = $bbp->shortcodes->display_view( array( 'id' => get_query_var( 'bbp_view' ) ) ); 826 844 845 /** Search ************************************************************/ 846 847 } elseif ( bbp_is_search() ) { 848 $new_content = $bbp->shortcodes->display_search( array( 'search' => get_query_var( 'bbp_search' ) ) ); 849 827 850 /** Topic Tags ********************************************************/ 828 851 829 852 // Show topics of tag -
templates/default/bbpress/content-search-forum.php
1 <?php 2 3 /** 4 * Search Loop - Single Forum 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <li> 13 14 <h3><a href="<?php bbp_forum_permalink(); ?>"><?php printf( __( 'Forum: %s', 'bbpress' ), bbp_get_forum_title() ); ?></a></h3> 15 16 <?php the_excerpt(); ?> 17 18 </li> -
templates/default/bbpress/content-search-reply.php
1 <?php 2 3 /** 4 * Search Loop - Single Reply 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <li class="bbp-reply"> 13 14 <h3><a href="<?php bbp_reply_permalink(); ?>"><?php printf( __( 'Reply to %s', 'bbpress' ), bbp_topic_title( bbp_get_reply_topic_id() ) ); ?></a></h3> 15 16 <p class="date"><?php printf( _x( 'Topic started by %s', 'bbpress' ), bbp_get_topic_author_link( bbp_get_reply_topic_id() ) ); ?> 17 18 on <?php printf( __( '%1$s <span>in <a href="%2$s">%3$s</a></span>', 'bbpress' ), get_the_date(), bbp_get_forum_permalink( bbp_get_reply_forum_id() ), bbp_get_forum_title( bbp_get_reply_forum_id() ) ); ?></p> 19 20 <?php bbp_get_reply_excerpt(); ?> 21 22 </li> -
templates/default/bbpress/content-search-topic.php
1 <?php 2 3 /** 4 * Search Loop - Single Topic 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <li class="bbp-topic"> 13 14 <h3><a href="<?php bbp_topic_permalink(); ?>"><?php printf( __( 'Topic: %s', 'bbpress' ), bbp_get_topic_title() ); ?></a></h3> 15 16 <p class="date"><?php printf( __( 'Topic started by %s', 'bbpress' ), bbp_get_topic_author_link( array( 'post_id' => get_the_ID(), 'size' => 20 ) ) ) ?> 17 18 on <?php printf( __( '%1$s <span>in <a href="%2$s">%3$s</a></span>', 'bbpress' ), get_the_date(), bbp_get_forum_permalink( bbp_get_topic_forum_id() ), bbp_get_forum_title( bbp_get_topic_forum_id() ) ); ?></p> 19 20 <?php bbp_get_topic_excerpt(); ?> 21 22 </li> -
templates/default/bbpress/content-search.php
1 <?php 2 3 /** 4 * Search Content Part 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div id="bbpress-forums"> 13 14 <?php bbp_breadcrumb(); ?> 15 16 <?php bbp_set_query_name( 'bbp_search' ); ?> 17 18 <?php do_action( 'bbp_template_before_search' ); ?> 19 20 <?php if ( bbp_has_search_results() ) : ?> 21 22 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 23 24 <?php bbp_get_template_part( 'loop', 'search' ); ?> 25 26 <?php bbp_get_template_part( 'pagination', 'search' ); ?> 27 28 <?php else : ?> 29 30 <?php _e( 'No search results.', 'bbpress' ); ?> 31 32 <?php endif; ?> 33 34 <?php bbp_get_template_part( 'form', 'search' ); ?> 35 36 <?php do_action( 'bbp_template_after_search_results' ); ?> 37 38 </div> -
templates/default/bbpress/loop-search.php
1 <?php 2 3 /** 4 * Search Loop 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <?php do_action( 'bbp_template_before_search_results_loop' ); ?> 13 14 <ul id="search_results" class="forums bbp-search-results"> 15 16 <?php while( bbp_search_results() ) : bbp_the_search_result(); ?> 17 18 <?php bbp_get_template_part( 'content', 'search-' . get_post_type() ); ?> 19 20 <?php endwhile; ?> 21 22 </ul><!-- #search_results --> 23 24 <?php do_action( 'bbp_template_after_search_results_loop' ); ?>