Ticket #1575: 1575.7.diff
File 1575.7.diff, 52.0 KB (added by , 13 years ago) |
---|
-
bbpress.php
180 180 181 181 /** Versions **********************************************************/ 182 182 183 $this->version = '2.3-bleeding-45 14';183 $this->version = '2.3-bleeding-4579'; 184 184 $this->db_version = '220'; 185 185 186 186 /** Paths *************************************************************/ … … 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 … … 309 311 require( $this->includes_dir . 'replies/functions.php' ); 310 312 require( $this->includes_dir . 'replies/template-tags.php' ); 311 313 314 // Search 315 require( $this->includes_dir . 'search/functions.php' ); 316 require( $this->includes_dir . 'search/template-tags.php' ); 317 312 318 // Users 313 319 require( $this->includes_dir . 'users/capabilities.php' ); 314 320 require( $this->includes_dir . 'users/functions.php' ); … … 358 364 'register_views', // Register the views (no-replies) 359 365 'register_theme_packages', // Register bundled theme packages (bbp-theme-compat/bbp-themes) 360 366 'load_textdomain', // Load textdomain (bbpress) 361 'add_rewrite_tags', // Add rewrite tags (view|user|edit )362 'generate_rewrite_rules' // Generate rewrite rules (view|edit )367 'add_rewrite_tags', // Add rewrite tags (view|user|edit|search) 368 'generate_rewrite_rules' // Generate rewrite rules (view|edit|search) 363 369 ); 364 370 365 371 // Add the actions … … 832 838 public static function add_rewrite_tags() { 833 839 add_rewrite_tag( '%%' . bbp_get_view_rewrite_id() . '%%', '([^/]+)' ); // View Page tag 834 840 add_rewrite_tag( '%%' . bbp_get_edit_rewrite_id() . '%%', '([1]{1,})' ); // Edit Page tag 841 add_rewrite_tag( '%%' . bbp_get_search_rewrite_id() . '%%', '([^/]+)' ); // Search Results tag 835 842 add_rewrite_tag( '%%' . bbp_get_user_rewrite_id() . '%%', '([^/]+)' ); // User Profile tag 836 843 add_rewrite_tag( '%%' . bbp_get_user_favorites_rewrite_id() . '%%', '([1]{1,})' ); // User Favorites tag 837 844 add_rewrite_tag( '%%' . bbp_get_user_subscriptions_rewrite_id() . '%%', '([1]{1,})' ); // User Subscriptions tag … … 853 860 public static function generate_rewrite_rules( $wp_rewrite ) { 854 861 855 862 // Slugs 856 $view_slug = bbp_get_view_slug(); 857 $user_slug = bbp_get_user_slug(); 863 $view_slug = bbp_get_view_slug(); 864 $search_slug = bbp_get_search_slug(); 865 $user_slug = bbp_get_user_slug(); 858 866 859 867 // 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(); 868 $edit_id = bbp_get_edit_rewrite_id(); 869 $view_id = bbp_get_view_rewrite_id(); 870 $search_id = bbp_get_search_rewrite_id(); 871 $user_id = bbp_get_user_rewrite_id(); 872 $favs_id = bbp_get_user_favorites_rewrite_id(); 873 $subs_id = bbp_get_user_subscriptions_rewrite_id(); 874 $tops_id = bbp_get_user_topics_rewrite_id(); 875 $reps_id = bbp_get_user_replies_rewrite_id(); 867 876 868 877 // Rewrite rule matches used repeatedly below 869 $root_rule = '/([^/]+)/?$';870 $edit_rule = '/([^/]+)/edit/?$';871 $feed_rule = '/([^/]+)/feed/?$';872 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$';878 $root_rule = '/([^/]+)/?$'; 879 $edit_rule = '/([^/]+)/edit/?$'; 880 $feed_rule = '/([^/]+)/feed/?$'; 881 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$'; 873 882 883 // Search rules (without slug check) 884 $search_root_rule = '/?$'; 885 $search_page_rule = '/page/?([0-9]{1,})/?$'; 886 874 887 // User profile rules 875 888 $tops_rule = '/([^/]+)/topics/?$'; 876 889 $reps_rule = '/([^/]+)/replies/?$'; … … 907 920 $view_slug . $page_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 908 921 $view_slug . $feed_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&feed=' . $wp_rewrite->preg_index( 2 ), 909 922 $view_slug . $root_rule => 'index.php?' . $view_id . '=' . $wp_rewrite->preg_index( 1 ), 923 924 // Search All 925 $search_slug . $search_page_rule => 'index.php?&paged=' . $wp_rewrite->preg_index( 1 ), 926 $search_slug . $search_root_rule => 'index.php?', 910 927 ); 911 928 912 929 // 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 * @since bbPress (r4579) 898 * 899 * @uses bbp_form_option() To output the option value 900 */ 901 function bbp_admin_setting_callback_search_slug() { 902 ?> 903 904 <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' ); ?> /> 905 906 <?php 907 // Slug Check 908 bbp_form_slug_conflict_check( '_bbp_search_slug', 'search' ); 909 } 910 886 911 /** BuddyPress ****************************************************************/ 887 912 888 913 /** -
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 * @since bbPress (r4579) 617 * 618 * @param array $attr 619 * @param string $content 620 * @uses bbp_search_query() 621 * @uses get_template_part() 622 */ 623 public function display_search( $attr, $content = '' ) { 624 625 // Set passed attribute to $search_terms for clarity 626 $search_terms = $attr['search']; 627 628 // Start output buffer 629 $this->start( 'bbp_search' ); 630 631 // Unset globals 632 $this->unset_globals(); 633 634 // Load the search 635 bbp_search_query( array( 's' => $search_terms ) ); 636 637 // Output template 638 bbp_get_template_part( 'content', 'search' ); 639 640 // Return contents of output buffer 641 return $this->end(); 642 } 643 605 644 /** Account ***************************************************************/ 606 645 607 646 /** -
includes/common/template-tags.php
784 784 } 785 785 786 786 /** 787 * Check if current page is a search page 788 * 789 * @since bbPress (r4579) 790 * 791 * @global WP_Query $wp_query To check if WP_Query::bbp_is_search is true 792 * @uses bbp_is_query_name() To get the query name 793 * @return bool Is it a search page? 794 */ 795 function bbp_is_search() { 796 global $wp_query; 797 798 // Assume false 799 $retval = false; 800 801 // Check query 802 if ( !empty( $wp_query->bbp_is_search ) && ( true == $wp_query->bbp_is_search ) ) 803 $retval = true; 804 805 // Check query name 806 if ( empty( $retval ) && bbp_is_query_name( 'bbp_search' ) ) 807 $retval = true; 808 809 // Check $_GET 810 if ( empty( $retval ) && isset( $_GET[bbp_get_search_rewrite_id()] ) ) 811 $retval = true; 812 813 return (bool) apply_filters( 'bbp_is_search', $retval ); 814 } 815 816 /** 787 817 * Check if current page is an edit page 788 818 * 789 819 * @since bbPress (r3585) … … 2409 2439 // Views 2410 2440 } elseif ( bbp_is_single_view() ) { 2411 2441 $title = sprintf( __( 'View: %s', 'bbpress' ), bbp_get_view_title() ); 2442 2443 /** Search ****************************************************************/ 2444 2445 // Search 2446 } elseif ( bbp_is_search() ) { 2447 $title = bbp_get_search_title(); 2412 2448 } 2413 2449 2414 2450 // Filter the raw title -
includes/common/widgets.php
320 320 } 321 321 322 322 /** 323 * bbPress Search Widget 324 * 325 * Adds a widget which displays the forum search form 326 * 327 * @since bbPress (r4579) 328 * 329 * @uses WP_Widget 330 */ 331 class BBP_Search_Widget extends WP_Widget { 332 333 /** 334 * bbPress Search Widget 335 * 336 * Registers the search widget 337 * 338 * @since bbPress (r4579) 339 * 340 * @uses apply_filters() Calls 'bbp_search_widget_options' with the 341 * widget options 342 */ 343 public function __construct() { 344 $widget_ops = apply_filters( 'bbp_search_widget_options', array( 345 'classname' => 'widget_display_search', 346 'description' => __( 'The bbPress forum search form.', 'bbpress' ) 347 ) ); 348 349 parent::__construct( false, __( '(bbPress) Forum Search Form', 'bbpress' ), $widget_ops ); 350 } 351 352 /** 353 * Register the widget 354 * 355 * @since bbPress (r4579) 356 * 357 * @uses register_widget() 358 */ 359 public static function register_widget() { 360 register_widget( 'BBP_Search_Widget' ); 361 } 362 363 /** 364 * Displays the output, the search form 365 * 366 * @since bbPress (r4579) 367 * 368 * @uses apply_filters() Calls 'bbp_search_widget_title' with the title 369 * @uses get_template_part() To get the search form 370 */ 371 public function widget( $args, $instance ) { 372 373 // Typical WordPress filter 374 $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); 375 376 // bbPress filter 377 $title = apply_filters( 'bbp_search_widget_title', $instance['title'], $instance, $this->id_base ); 378 379 echo $args['before_widget']; 380 echo $args['before_title'] . $title . $args['after_title']; 381 382 bbp_get_template_part( 'form', 'search' ); 383 384 echo $args['after_widget']; 385 } 386 387 /** 388 * Update the widget options 389 * 390 * @since bbPress (r4579) 391 * 392 * @param array $new_instance The new instance options 393 * @param array $old_instance The old instance options 394 */ 395 public function update( $new_instance, $old_instance ) { 396 $instance = $old_instance; 397 $instance['title'] = strip_tags( $new_instance['title'] ); 398 399 return $instance; 400 } 401 402 /** 403 * Output the search widget options form 404 * 405 * @since bbPress (r4579) 406 * 407 * @param $instance Instance 408 * @uses BBP_Search_Widget::get_field_id() To output the field id 409 * @uses BBP_Search_Widget::get_field_name() To output the field name 410 */ 411 public function form( $instance ) { 412 $title = !empty( $instance['title'] ) ? esc_attr( $instance['title'] ) : ''; ?> 413 414 <p> 415 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'bbpress' ); ?> 416 <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo $title; ?>" /> 417 </label> 418 </p> 419 420 <?php 421 } 422 } 423 424 /** 323 425 * bbPress Forum Widget 324 426 * 325 427 * Adds a widget which displays the forum list -
includes/core/actions.php
138 138 // Widgets 139 139 add_action( 'bbp_widgets_init', array( 'BBP_Login_Widget', 'register_widget' ), 10 ); 140 140 add_action( 'bbp_widgets_init', array( 'BBP_Views_Widget', 'register_widget' ), 10 ); 141 add_action( 'bbp_widgets_init', array( 'BBP_Search_Widget', 'register_widget' ), 10 ); 141 142 add_action( 'bbp_widgets_init', array( 'BBP_Forums_Widget', 'register_widget' ), 10 ); 142 143 add_action( 'bbp_widgets_init', array( 'BBP_Topics_Widget', 'register_widget' ), 10 ); 143 144 add_action( 'bbp_widgets_init', array( 'BBP_Replies_Widget', 'register_widget' ), 10 ); -
includes/core/functions.php
435 435 } 436 436 437 437 /** 438 * Return the enique ID for all edit rewrite rules (forum|topic|reply|tag|user)438 * Return the unique ID for all edit rewrite rules (forum|topic|reply|tag|user) 439 439 * 440 440 * @since bbPress (r3762) 441 441 * @return string … … 445 445 } 446 446 447 447 /** 448 * Return the unique ID for all search rewrite rules 449 * 450 * @since bbPress (r4579) 451 * 452 * @return string 453 */ 454 function bbp_get_search_rewrite_id() { 455 return bbpress()->search_id; 456 } 457 458 /** 448 459 * Return the unique ID for user topics rewrite rules 449 460 * 450 461 * @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 * @since bbPress (r4579) 507 * 508 * @return string 509 */ 510 function bbp_get_search_slug( $default = 'search' ) { 511 return apply_filters( 'bbp_get_search_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_search_slug', $default ) ); 512 } 513 502 514 /** Legacy ********************************************************************/ 503 515 504 516 /** -
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 * @since bbPress (r4579) 262 * 263 * @uses bbp_get_query_template() 264 * @return string Path to template file 265 */ 266 function bbp_get_search_template() { 267 $templates = array( 268 'page-forum-search.php', // Single Search 269 'forum-search.php', // Search 270 ); 271 return bbp_get_query_template( 'single_search', $templates ); 272 } 273 274 /** 254 275 * Get the single forum template 255 276 * 256 277 * @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 -
includes/forums/template-tags.php
140 140 * @uses bbPress::forum_query::in_the_loop To check if we're in the loop 141 141 * @uses bbPress::forum_query::post::ID To get the forum id 142 142 * @uses WP_Query::post::ID To get the forum id 143 * @uses bbp_is_forum() To check if the search result is a forum 143 144 * @uses bbp_is_single_forum() To check if it's a forum page 144 145 * @uses bbp_is_single_topic() To check if it's a topic page 145 146 * @uses bbp_get_topic_forum_id() To get the topic forum id … … 161 162 } elseif ( !empty( $bbp->forum_query->in_the_loop ) && isset( $bbp->forum_query->post->ID ) ) { 162 163 $bbp_forum_id = $bbp->forum_query->post->ID; 163 164 165 // Currently inside a search loop 166 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_forum( $bbp->search_query->post->ID ) ) { 167 $bbp_forum_id = $bbp->search_query->post->ID; 168 164 169 // Currently viewing a forum 165 170 } elseif ( bbp_is_single_forum() && !empty( $bbp->current_forum_id ) ) { 166 171 $bbp_forum_id = $bbp->current_forum_id; -
includes/replies/template-tags.php
223 223 * 224 224 * @param $reply_id Optional. Used to check emptiness 225 225 * @uses bbPress::reply_query::post::ID To get the reply id 226 * @uses bbp_is_reply() To check if it's a reply page 226 * @uses bbp_is_reply() To check if the search result is a reply 227 * @uses bbp_is_single_reply() To check if it's a reply page 227 228 * @uses bbp_is_reply_edit() To check if it's a reply edit page 228 229 * @uses get_post_field() To get the post's post type 229 230 * @uses WP_Query::post::ID To get the reply id … … 245 246 } elseif ( !empty( $bbp->reply_query->in_the_loop ) && isset( $bbp->reply_query->post->ID ) ) { 246 247 $bbp_reply_id = $bbp->reply_query->post->ID; 247 248 249 // Currently inside a search loop 250 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_reply( $bbp->search_query->post->ID ) ) { 251 $bbp_reply_id = $bbp->search_query->post->ID; 252 248 253 // Currently viewing a forum 249 254 } elseif ( ( bbp_is_single_reply() || bbp_is_reply_edit() ) && !empty( $bbp->current_reply_id ) ) { 250 255 $bbp_reply_id = $bbp->current_reply_id; -
includes/search/functions.php
1 <?php 2 3 /** 4 * bbPress Search Functions 5 * 6 * @package bbPress 7 * @subpackage Functions 8 */ 9 10 // Exit if accessed directly 11 if ( !defined( 'ABSPATH' ) ) exit; 12 13 /** Query *********************************************************************/ 14 15 /** 16 * Run the search query 17 * 18 * @since bbPress (r4579) 19 * 20 * @param mixed $new_args New arguments 21 * @uses bbp_get_search_query_args() To get the search query args 22 * @uses bbp_parse_args() To parse the args 23 * @uses bbp_has_search_results() To make the search query 24 * @return bool False if no results, otherwise if search results are there 25 */ 26 function bbp_search_query( $new_args = '' ) { 27 28 $query_args = bbp_get_search_query_args(); 29 if ( empty( $query_args ) ) 30 return false; 31 32 // Merge arguments 33 if ( !empty( $new_args ) ) { 34 $new_args = bbp_parse_args( $new_args, '', 'search_query' ); 35 $query_args = array_merge( $query_args, $new_args ); 36 } 37 38 return bbp_has_search_results( $query_args ); 39 } 40 41 /** 42 * Return the search's query args 43 * 44 * @since bbPress (r4579) 45 * 46 * @uses bbp_get_search_terms() To get the search terms 47 * @return array Query arguments 48 */ 49 function bbp_get_search_query_args() { 50 51 // Get search terms 52 $search_terms = bbp_get_search_terms(); 53 $retval = !empty( $search_terms ) ? array( 's' => $search_terms ) : false; 54 55 return apply_filters( 'bbp_get_search_query_args', $retval ); 56 } -
includes/search/template-tags.php
1 <?php 2 3 /** 4 * bbPress Search Template Tags 5 * 6 * @package bbPress 7 * @subpackage TemplateTags 8 */ 9 10 // Exit if accessed directly 11 if ( !defined( 'ABSPATH' ) ) exit; 12 13 /** Search Loop Functions *****************************************************/ 14 15 /** 16 * The main search loop. WordPress does the heavy lifting. 17 * 18 * @since bbPress (r4579) 19 * 20 * @param mixed $args All the arguments supported by {@link WP_Query} 21 * @uses bbp_get_view_all() Are we showing all results? 22 * @uses bbp_get_public_status_id() To get the public status id 23 * @uses bbp_get_closed_status_id() To get the closed status id 24 * @uses bbp_get_spam_status_id() To get the spam status id 25 * @uses bbp_get_trash_status_id() To get the trash status id 26 * @uses bbp_get_forum_post_type() To get the forum post type 27 * @uses bbp_get_topic_post_type() To get the topic post type 28 * @uses bbp_get_reply_post_type() To get the reply post type 29 * @uses bbp_get_replies_per_page() To get the replies per page option 30 * @uses bbp_get_paged() To get the current page value 31 * @uses bbp_get_search_terms() To get the search terms 32 * @uses WP_Query To make query and get the search results 33 * @uses WP_Rewrite::using_permalinks() To check if the blog is using permalinks 34 * @uses bbp_get_search_url() To get the forum search url 35 * @uses paginate_links() To paginate search results 36 * @uses apply_filters() Calls 'bbp_has_search_results' with 37 * bbPress::search_query::have_posts() 38 * and bbPress::reply_query 39 * @return object Multidimensional array of search information 40 */ 41 function bbp_has_search_results( $args = '' ) { 42 global $wp_rewrite; 43 44 /** Defaults **************************************************************/ 45 46 // What are the default allowed statuses (based on user caps) 47 if ( bbp_get_view_all( 'edit_others_replies' ) ) { 48 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id(), bbp_get_spam_status_id(), bbp_get_trash_status_id() ); 49 } else { 50 $post_statuses = array( bbp_get_public_status_id(), bbp_get_closed_status_id() ); 51 } 52 53 $default_post_type = array( bbp_get_forum_post_type(), bbp_get_topic_post_type(), bbp_get_reply_post_type() ); 54 $default_post_status = join( ',', $post_statuses ); 55 56 // Default query args 57 $default = array( 58 'post_type' => $default_post_type, // Forums, topics, and replies 59 'post_status' => $default_post_status, // Of this status 60 'posts_per_page' => bbp_get_replies_per_page(), // This many 61 'paged' => bbp_get_paged(), // On this page 62 'orderby' => 'date', // Sorted by date 63 'order' => 'DESC', // Most recent first 64 's' => bbp_get_search_terms(), // This is a search 65 ); 66 67 /** Setup *****************************************************************/ 68 69 // Parse arguments against default values 70 $r = bbp_parse_args( $args, $default, 'has_search_results' ); 71 72 // Don't bother if we don't have search terms 73 if ( empty( $r['s'] ) ) 74 return false; 75 76 // Get bbPress 77 $bbp = bbpress(); 78 79 // Call the query 80 $bbp->search_query = new WP_Query( $r ); 81 82 // Add pagination values to query object 83 $bbp->search_query->posts_per_page = $r['posts_per_page']; 84 $bbp->search_query->paged = $r['paged']; 85 86 // Never home, regardless of what parse_query says 87 $bbp->search_query->is_home = false; 88 89 // Found posts 90 if ( !$bbp->search_query->found_posts ) 91 return false; 92 93 // Only add pagination is query returned results 94 if ( (int) $bbp->search_query->found_posts && (int) $bbp->search_query->posts_per_page ) { 95 96 // If pretty permalinks are enabled, make our pagination pretty 97 if ( $wp_rewrite->using_permalinks() ) { 98 99 // Search 100 $base = trailingslashit( bbp_get_search_url() ) . user_trailingslashit( $wp_rewrite->pagination_base . '/%#%/' ); 101 102 // Unpretty permalinks 103 } else { 104 $base = add_query_arg( 'paged', '%#%' ); 105 } 106 107 // Add args 108 $add_args = array( bbp_get_search_rewrite_id() => esc_attr( bbp_get_search_terms() ) ); 109 if ( bbp_get_view_all() ) 110 $add_args['view'] = 'all'; 111 112 // Add pagination to query object 113 $bbp->search_query->pagination_links = paginate_links( 114 apply_filters( 'bbp_search_results_pagination', array( 115 'base' => $base, 116 'format' => '', 117 'total' => ceil( (int) $bbp->search_query->found_posts / (int) $r['posts_per_page'] ), 118 'current' => (int) $bbp->search_query->paged, 119 'prev_text' => '←', 120 'next_text' => '→', 121 'mid_size' => 1, 122 'add_args' => $add_args, 123 ) ) 124 ); 125 126 // Remove first page from pagination 127 if ( $wp_rewrite->using_permalinks() ) { 128 $bbp->search_query->pagination_links = str_replace( $wp_rewrite->pagination_base . '/1/', '', $bbp->search_query->pagination_links ); 129 } else { 130 $bbp->search_query->pagination_links = str_replace( '&paged=1', '', $bbp->search_query->pagination_links ); 131 } 132 } 133 134 // Return object 135 return apply_filters( 'bbp_has_search_results', $bbp->search_query->have_posts(), $bbp->search_query ); 136 } 137 138 /** 139 * Whether there are more search results available in the loop 140 * 141 * @since bbPress (r4579) 142 * 143 * @uses WP_Query bbPress::search_query::have_posts() To check if there are more 144 * search results available 145 * @return object Search information 146 */ 147 function bbp_search_results() { 148 149 // Put into variable to check against next 150 $have_posts = bbpress()->search_query->have_posts(); 151 152 // Reset the post data when finished 153 if ( empty( $have_posts ) ) 154 wp_reset_postdata(); 155 156 return $have_posts; 157 } 158 159 /** 160 * Loads up the current search result in the loop 161 * 162 * @since bbPress (r4579) 163 * 164 * @uses WP_Query bbPress::search_query::the_post() To get the current search result 165 * @return object Search information 166 */ 167 function bbp_the_search_result() { 168 $search_result = bbpress()->search_query->the_post(); 169 170 // Reset each current (forum|topic|reply) id 171 bbpress()->current_forum_id = bbp_get_forum_id(); 172 bbpress()->current_topic_id = bbp_get_topic_id(); 173 bbpress()->current_reply_id = bbp_get_reply_id(); 174 175 return $search_result; 176 } 177 178 /** 179 * Output the search page title 180 * 181 * @since bbPress (r4579) 182 * 183 * @uses bbp_get_search_title() 184 */ 185 function bbp_search_title() { 186 echo bbp_get_search_title(); 187 } 188 189 /** 190 * Get the search page title 191 * 192 * @since bbPress (r4579) 193 * 194 * @uses bbp_get_search_terms() 195 */ 196 function bbp_get_search_title() { 197 198 // Get search terms 199 $search_terms = bbp_get_search_terms(); 200 201 // No search terms specified 202 if ( empty( $search_terms ) ) { 203 return __( 'Search', 'bbpress' ); 204 205 // Include search terms in title 206 } else { 207 return sprintf( __( "Search Results for '%s'", 'bbpress' ), esc_attr( $search_terms ) ); 208 } 209 } 210 211 /** 212 * Output the search url 213 * 214 * @since bbPress (r4579) 215 * 216 * @uses bbp_get_search_url() To get the search url 217 */ 218 function bbp_search_url() { 219 echo bbp_get_search_url(); 220 } 221 /** 222 * Return the search url 223 * 224 * @since bbPress (r4579) 225 * 226 * @uses user_trailingslashit() To fix slashes 227 * @uses trailingslashit() To fix slashes 228 * @uses bbp_get_forums_url() To get the root forums url 229 * @uses bbp_get_search_slug() To get the search slug 230 * @uses add_query_arg() To help make unpretty permalinks 231 * @return string Search url 232 */ 233 function bbp_get_search_url() { 234 global $wp_rewrite; 235 236 // Pretty permalinks 237 if ( $wp_rewrite->using_permalinks() ) { 238 $url = $wp_rewrite->root . bbp_get_search_slug(); 239 $url = home_url( user_trailingslashit( $url ) ); 240 241 // Unpretty permalinks 242 } else { 243 $search_terms = bbp_get_search_terms(); 244 $url = add_query_arg( array( 'bbp_search' => $search_terms ), home_url( '/' ) ); 245 } 246 247 return apply_filters( 'bbp_get_search_url', $url ); 248 } 249 250 251 /** 252 * Output the search terms 253 * 254 * @since bbPress (r4579) 255 * 256 * @param string $search_terms Optional. Search terms 257 * @uses bbp_get_search_terms() To get the search terms 258 */ 259 function bbp_search_terms( $search_terms = '' ) { 260 echo bbp_get_search_terms( $search_terms ); 261 } 262 263 /** 264 * Get the search terms 265 * 266 * @since bbPress (r4579) 267 * 268 * If search terms are supplied, those are used. Otherwise check the 269 * search rewrite id query var. 270 * 271 * @param string $search_terms Optional. Search terms 272 * @uses sanitize_title() To sanitize the search terms 273 * @uses get_query_var*( To get the search terms from query var 'bbp_search' 274 * @return bool|string Search terms on success, false on failure 275 */ 276 function bbp_get_search_terms( $search_terms = '' ) { 277 278 $search_terms = !empty( $search_terms ) ? sanitize_title( $search_terms ) : get_query_var( bbp_get_search_rewrite_id() ); 279 280 if ( !empty( $search_terms ) ) 281 return $search_terms; 282 283 return false; 284 } 285 286 /** 287 * Output the search result pagination count 288 * 289 * @since bbPress (r4579) 290 * 291 * @uses bbp_get_search_pagination_count() To get the search result pagination count 292 */ 293 function bbp_search_pagination_count() { 294 echo bbp_get_search_pagination_count(); 295 } 296 297 /** 298 * Return the search results pagination count 299 * 300 * @since bbPress (r4579) 301 * 302 * @uses bbp_number_format() To format the number value 303 * @uses apply_filters() Calls 'bbp_get_search_pagination_count' with the 304 * pagination count 305 * @return string Search pagination count 306 */ 307 function bbp_get_search_pagination_count() { 308 $bbp = bbpress(); 309 310 // Define local variable(s) 311 $retstr = ''; 312 313 // Set pagination values 314 $start_num = intval( ( $bbp->search_query->paged - 1 ) * $bbp->search_query->posts_per_page ) + 1; 315 $from_num = bbp_number_format( $start_num ); 316 $to_num = bbp_number_format( ( $start_num + ( $bbp->search_query->posts_per_page - 1 ) > $bbp->search_query->found_posts ) ? $bbp->search_query->found_posts : $start_num + ( $bbp->search_query->posts_per_page - 1 ) ); 317 $total_int = (int) $bbp->search_query->found_posts; 318 $total = bbp_number_format( $total_int ); 319 320 // Single page of results 321 if ( empty( $to_num ) ) { 322 $retstr = sprintf( _n( 'Viewing %1$s result', 'Viewing %1$s results', $total_int, 'bbpress' ), $total ); 323 324 // Several pages of results 325 } else { 326 $retstr = sprintf( _n( 'Viewing %2$s results (of %4$s total)', 'Viewing %1$s results - %2$s through %3$s (of %4$s total)', $bbp->search_query->post_count, 'bbpress' ), $bbp->search_query->post_count, $from_num, $to_num, $total ); 327 328 } 329 330 // Filter and return 331 return apply_filters( 'bbp_get_search_pagination_count', $retstr ); 332 } 333 334 /** 335 * Output search pagination links 336 * 337 * @since bbPress (r4579) 338 * 339 * @uses bbp_get_search_pagination_links() To get the search pagination links 340 */ 341 function bbp_search_pagination_links() { 342 echo bbp_get_search_pagination_links(); 343 } 344 345 /** 346 * Return search pagination links 347 * 348 * @since bbPress (r4579) 349 * 350 * @uses apply_filters() Calls 'bbp_get_search_pagination_links' with the 351 * pagination links 352 * @return string Search pagination links 353 */ 354 function bbp_get_search_pagination_links() { 355 $bbp = bbpress(); 356 357 if ( !isset( $bbp->search_query->pagination_links ) || empty( $bbp->search_query->pagination_links ) ) 358 return false; 359 360 return apply_filters( 'bbp_get_search_pagination_links', $bbp->search_query->pagination_links ); 361 } -
includes/topics/template-tags.php
365 365 * 366 366 * @param $topic_id Optional. Used to check emptiness 367 367 * @uses bbPress::topic_query::post::ID To get the topic id 368 * @uses bbp_is_topic() To check if the search result is a topic 368 369 * @uses bbp_is_single_topic() To check if it's a topic page 369 370 * @uses bbp_is_topic_edit() To check if it's a topic edit page 370 371 * @uses bbp_is_single_reply() To check if it it's a reply page … … 390 391 } elseif ( !empty( $bbp->topic_query->in_the_loop ) && isset( $bbp->topic_query->post->ID ) ) { 391 392 $bbp_topic_id = $bbp->topic_query->post->ID; 392 393 394 // Currently inside a search loop 395 } elseif ( !empty( $bbp->search_query->in_the_loop ) && isset( $bbp->search_query->post->ID ) && bbp_is_topic( $bbp->search_query->post->ID ) ) { 396 $bbp_topic_id = $bbp->search_query->post->ID; 397 393 398 // Currently viewing/editing a topic, likely alone 394 399 } elseif ( ( bbp_is_single_topic() || bbp_is_topic_edit() ) && !empty( $bbp->current_topic_id ) ) { 395 400 $bbp_topic_id = $bbp->current_topic_id; -
templates/default/bbpress/content-archive-forum.php
11 11 12 12 <div id="bbpress-forums"> 13 13 14 <div class="bbp-search-form"> 15 16 <?php bbp_get_template_part( 'form', 'search' ); ?> 17 18 </div> 19 14 20 <?php bbp_breadcrumb(); ?> 15 21 16 22 <?php do_action( 'bbp_template_before_forums_index' ); ?> -
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 bbp_get_template_part( 'feedback', 'no-search' ); ?> 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> 39 -
templates/default/bbpress/feedback-no-search.php
1 <?php 2 3 /** 4 * Oh bother! 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-template-notice"> 13 <p><?php _e( 'Oh bother! No search results were found here!', 'bbpress' ); ?></p> 14 </div> -
templates/default/bbpress/form-search.php
1 <?php 2 3 /** 4 * Search 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <form role="search" method="get" id="bbp-search" action="<?php bbp_search_url(); ?>"> 13 <div> 14 <label class="screen-reader-text" for="bbp_search"><?php _e( 'Search for:', 'bbpress' ); ?></label> 15 <input type="text" value="<?php echo esc_attr( bbp_get_search_terms() ); ?>" name="bbp_search" id="bbp_search" /> 16 <input type="submit" id="bbp_search_submit" value="<?php _e( 'Search Forums', 'bbpress' ); ?>" /> 17 </div> 18 </form> -
templates/default/bbpress/loop-search-forum.php
1 <?php 2 3 /** 4 * Search Loop - Single Forum 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-forum-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-forum-post-date"><?php printf( __( 'Last updated %s', 'bbpress' ), bbp_get_forum_last_active_time() ); ?></span> 17 18 <a href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>" class="bbp-forum-permalink">#<?php bbp_forum_id(); ?></a> 19 20 </div><!-- .bbp-meta --> 21 22 <div class="bbp-forum-title"> 23 24 <?php do_action( 'bbp_theme_before_forum_title' ); ?> 25 26 <h3><?php _e( 'Forum: ', 'bbpress' ); ?><a href="<?php bbp_forum_permalink(); ?>" title="<?php bbp_forum_title(); ?>"><?php bbp_forum_title(); ?></a></h3> 27 28 <?php do_action( 'bbp_theme_after_forum_title' ); ?> 29 30 </div><!-- .bbp-forum-title"> 31 32 </div><!-- .bbp-forum-header --> 33 34 <div id="post-<?php bbp_forum_id(); ?>" <?php bbp_forum_class(); ?>> 35 36 <div class="bbp-forum-content"> 37 38 <?php do_action( 'bbp_theme_before_forum_content' ); ?> 39 40 <?php the_excerpt(); ?> 41 42 <?php do_action( 'bbp_theme_after_forum_content' ); ?> 43 44 </div><!-- .bbp-forum-content --> 45 46 </div><!-- #post-<?php bbp_forum_id(); ?> --> -
templates/default/bbpress/loop-search-reply.php
1 <?php 2 3 /** 4 * Search Loop - Single Reply 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-reply-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-reply-post-date"><?php bbp_reply_post_date(); ?></span> 17 18 <a href="<?php bbp_reply_url(); ?>" title="<?php bbp_reply_title(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_id(); ?></a> 19 20 <?php do_action( 'bbp_theme_before_reply_admin_links' ); ?> 21 22 <?php bbp_reply_admin_links(); ?> 23 24 <?php do_action( 'bbp_theme_after_reply_admin_links' ); ?> 25 26 </div><!-- .bbp-meta --> 27 28 <div class="bbp-reply-title"> 29 30 <h3><?php _e( 'In reply to: ', 'bbpress' ); ?> 31 <a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( bbp_get_reply_topic_id() ); ?>" title="<?php bbp_topic_title( bbp_get_reply_topic_id() ); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a></h3> 32 33 </div><!-- .bbp-reply-title --> 34 35 </div><!-- .bbp-reply-header --> 36 37 <div id="post-<?php bbp_reply_id(); ?>" <?php bbp_reply_class(); ?>> 38 39 <div class="bbp-reply-author"> 40 41 <?php do_action( 'bbp_theme_before_reply_author_details' ); ?> 42 43 <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 44 45 <?php if ( is_super_admin() ) : ?> 46 47 <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?> 48 49 <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div> 50 51 <?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?> 52 53 <?php endif; ?> 54 55 <?php do_action( 'bbp_theme_after_reply_author_details' ); ?> 56 57 </div><!-- .bbp-reply-author --> 58 59 <div class="bbp-reply-content"> 60 61 <?php do_action( 'bbp_theme_before_reply_content' ); ?> 62 63 <?php bbp_reply_content(); ?> 64 65 <?php do_action( 'bbp_theme_after_reply_content' ); ?> 66 67 </div><!-- .bbp-reply-content --> 68 69 </div><!-- #post-<?php bbp_reply_id(); ?> --> 70 -
templates/default/bbpress/loop-search-topic.php
1 <?php 2 3 /** 4 * Search Loop - Single Topic 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <div class="bbp-topic-header"> 13 14 <div class="bbp-meta"> 15 16 <span class="bbp-topic-post-date"><?php bbp_topic_post_date( bbp_get_topic_id() ); ?></span> 17 18 <a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>" class="bbp-topic-permalink">#<?php bbp_topic_id(); ?></a> 19 20 <?php do_action( 'bbp_theme_before_topic_admin_links' ); ?> 21 22 <?php bbp_topic_admin_links( bbp_get_topic_id() ); ?> 23 24 <?php do_action( 'bbp_theme_after_topic_admin_links' ); ?> 25 26 </div><!-- .bbp-meta --> 27 28 <div class="bbp-topic-title"> 29 30 <?php do_action( 'bbp_theme_before_topic_title' ); ?> 31 32 <h3><?php _e( 'Topic: ', 'bbpress' ); ?> 33 <a href="<?php bbp_topic_permalink(); ?>" title="<?php bbp_topic_title(); ?>"><?php bbp_topic_title(); ?></a></h3> 34 35 <div class="bbp-topic-title-meta"> 36 37 <?php if ( function_exists( 'bbp_is_forum_group_forum' ) && bbp_is_forum_group_forum( bbp_get_topic_forum_id() ) ) : ?> 38 39 <?php _e( 'in group forum ', 'bbpress' ); ?> 40 41 <?php else : ?> 42 43 <?php _e( 'in forum ', 'bbpress' ); ?> 44 45 <?php endif; ?> 46 47 <a href="<?php bbp_forum_permalink( bbp_get_topic_forum_id() ); ?>" title="<?php bbp_forum_title( bbp_get_topic_forum_id() ); ?>"><?php bbp_forum_title( bbp_get_topic_forum_id() ); ?></a> 48 49 </div><!-- .bbp-topic-title-meta --> 50 51 <?php do_action( 'bbp_theme_after_topic_title' ); ?> 52 53 </div><!-- .bbp-topic-title --> 54 55 </div><!-- .bbp-topic-header --> 56 57 <div id="post-<?php bbp_topic_id(); ?>" <?php bbp_topic_class(); ?>> 58 59 <div class="bbp-topic-author"> 60 61 <?php do_action( 'bbp_theme_before_topic_author_details' ); ?> 62 63 <?php bbp_topic_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?> 64 65 <?php if ( is_super_admin() ) : ?> 66 67 <?php do_action( 'bbp_theme_before_topic_author_admin_details' ); ?> 68 69 <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_topic_id() ); ?></div> 70 71 <?php do_action( 'bbp_theme_after_topic_author_admin_details' ); ?> 72 73 <?php endif; ?> 74 75 <?php do_action( 'bbp_theme_after_topic_author_details' ); ?> 76 77 </div><!-- .bbp-topic-author --> 78 79 <div class="bbp-topic-content"> 80 81 <?php do_action( 'bbp_theme_before_topic_content' ); ?> 82 83 <?php bbp_topic_content(); ?> 84 85 <?php do_action( 'bbp_theme_after_topic_content' ); ?> 86 87 </div><!-- .bbp-topic-content --> 88 89 </div><!-- #post-<?php bbp_topic_id(); ?> --> -
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="bbp-search-results" class="forums bbp-search-results"> 15 16 <li class="bbp-header"> 17 18 <div class="bbp-search-author"><?php _e( 'Author', 'bbpress' ); ?></div><!-- .bbp-reply-author --> 19 20 <div class="bbp-search-content"> 21 22 <?php _e( 'Search Results', 'bbpress' ); ?> 23 24 </div><!-- .bbp-search-content --> 25 26 </li><!-- .bbp-header --> 27 28 <li class="bbp-body"> 29 30 <?php while ( bbp_search_results() ) : bbp_the_search_result(); ?> 31 32 <?php bbp_get_template_part( 'loop', 'search-' . get_post_type() ); ?> 33 34 <?php endwhile; ?> 35 36 </li><!-- .bbp-body --> 37 38 <li class="bbp-footer"> 39 40 <div class="bbp-search-author"><?php _e( 'Author', 'bbpress' ); ?></div> 41 42 <div class="bbp-search-content"> 43 44 <?php _e( 'Search Results', 'bbpress' ); ?> 45 46 </div><!-- .bbp-search-content --> 47 48 </li><!-- .bbp-footer --> 49 50 </ul><!-- #bbp-search-results --> 51 52 <?php do_action( 'bbp_template_after_search_results_loop' ); ?> 53 No newline at end of file -
templates/default/bbpress/pagination-search.php
1 <?php 2 3 /** 4 * Pagination for pages of search results 5 * 6 * @package bbPress 7 * @subpackage Theme 8 */ 9 10 ?> 11 12 <?php do_action( 'bbp_template_before_pagination_loop' ); ?> 13 14 <div class="bbp-pagination"> 15 <div class="bbp-pagination-count"> 16 17 <?php bbp_search_pagination_count(); ?> 18 19 </div> 20 21 <div class="bbp-pagination-links"> 22 23 <?php bbp_search_pagination_links(); ?> 24 25 </div> 26 </div> 27 28 <?php do_action( 'bbp_template_after_pagination_loop' ); ?> -
templates/default/css/bbpress.css
34 34 height: auto; 35 35 } 36 36 37 #bbpress-forums div.bbp-forum-header, 37 38 #bbpress-forums div.bbp-topic-header, 38 39 #bbpress-forums div.bbp-reply-header { 39 40 background-color: #f4f4f4; … … 67 68 #bbpress-forums ul.bbp-lead-topic, 68 69 #bbpress-forums ul.bbp-topics, 69 70 #bbpress-forums ul.bbp-forums, 70 #bbpress-forums ul.bbp-replies { 71 #bbpress-forums ul.bbp-replies, 72 #bbpress-forums ul.bbp-search-results { 71 73 font-size: 12px; 72 74 overflow: hidden; 73 75 border: 1px solid #eee; … … 166 168 float: right; 167 169 } 168 170 171 #bbpress-forums div.bbp-forum-title h3, 172 #bbpress-forums div.bbp-topic-title h3, 173 #bbpress-forums div.bbp-reply-title h3 { 174 line-height: 1em; 175 margin: 8px 0; 176 } 177 178 #bbpress-forums div.bbp-search-author, 179 #bbpress-forums div.bbp-forum-author, 169 180 #bbpress-forums div.bbp-topic-author, 170 181 #bbpress-forums div.bbp-reply-author { 171 182 float: left; … … 173 184 width: 115px; 174 185 } 175 186 187 #bbpress-forums div.bbp-forum-author img.avatar, 176 188 #bbpress-forums div.bbp-topic-author img.avatar, 177 189 #bbpress-forums div.bbp-reply-author img.avatar { 178 190 border: none; … … 182 194 float: none; 183 195 } 184 196 197 #bbpress-forums div.bbp-forum-author a.bbp-author-name, 185 198 #bbpress-forums div.bbp-topic-author a.bbp-author-name, 186 199 #bbpress-forums div.bbp-reply-author a.bbp-author-name { 187 200 margin: 0 12px; 188 201 word-break: break-word; 189 202 } 190 203 204 #bbpress-forums div.bbp-forum-author .bbp-author-role, 191 205 #bbpress-forums div.bbp-topic-author .bbp-author-role, 192 206 #bbpress-forums div.bbp-reply-author .bbp-author-role { 193 207 font-size: 11px; 194 208 font-style: italic; 195 209 } 196 210 211 #bbpress-forums div.bbp-forum-content, 197 212 #bbpress-forums div.bbp-topic-content, 198 213 #bbpress-forums div.bbp-reply-content { 199 214 margin-left: 140px; … … 201 216 text-align: left; 202 217 } 203 218 219 #bbpress-forums li.bbp-header .bbp-forum-author, 220 #bbpress-forums li.bbp-footer .bbp-forum-author, 204 221 #bbpress-forums li.bbp-header .bbp-topic-author, 205 222 #bbpress-forums li.bbp-footer .bbp-topic-author, 206 223 #bbpress-forums li.bbp-header .bbp-reply-author, … … 211 228 width: 120px; 212 229 } 213 230 231 #bbpress-forums li.bbp-header .bbp-forum-content, 232 #bbpress-forums li.bbp-footer .bbp-forum-content, 214 233 #bbpress-forums li.bbp-header .bbp-topic-content, 215 234 #bbpress-forums li.bbp-footer .bbp-topic-content, 216 235 #bbpress-forums li.bbp-header .bbp-reply-content, … … 220 239 text-align: left; 221 240 } 222 241 242 div.bbp-forum-header, 223 243 div.bbp-topic-header, 224 244 div.bbp-reply-header, 225 245 li.bbp-body div.hentry { … … 228 248 padding: 8px; 229 249 } 230 250 251 div.bbp-forum-header, 231 252 div.bbp-topic-header, 232 253 div.bbp-reply-header { 233 254 border-top: 1px solid #ddd; … … 262 283 float: right; 263 284 } 264 285 286 /* =Search 287 -------------------------------------------------------------- */ 288 289 div.bbp-search-form { 290 float: right; 291 } 292 293 265 294 /* =Admin Links 266 295 -------------------------------------------------------------- */ 267 296 … … 287 316 width: 50%; 288 317 } 289 318 319 .bbp-forum-header a.bbp-forum-permalink, 290 320 .bbp-topic-header a.bbp-topic-permalink, 291 321 .bbp-reply-header a.bbp-reply-permalink { 292 322 float: right;