Ticket #1649: 1649.2.diff
| File 1649.2.diff, 1.9 KB (added by , 13 years ago) |
|---|
-
shortcodes.php
377 377 * Display the topic form in an output buffer and return to ensure 378 378 * post/page contents are displayed first. 379 379 * 380 * Supports 'forum_id' attribute to display the topic form for a particular 381 * forum. 382 * 380 383 * @since bbPress (r3031) 381 384 * 385 * @param array $attr 386 * @param string $content 382 387 * @uses get_template_part() 383 388 */ 384 public function display_topic_form( ) {389 public function display_topic_form( $attr, $content = '' ) { 385 390 386 // Start output buffer 387 $this->start( 'bbp_topic_form' ); 391 // Sanity check supplied info 392 if ( !empty( $content ) || (!empty( $attr['forum_id'] ) && (!is_numeric( $attr['forum_id'] ) || !bbp_is_forum( $attr['forum_id'] ) ) ) ) 393 return $content; 388 394 389 // Output templates390 bbp_get_template_part( 'form', 'topic');395 // Unset globals 396 $this->unset_globals(); 391 397 398 // If forum id is set, use the 'bbp_single_forum' query name 399 if ( !empty( $attr['forum_id'] ) ) { 400 bbpress()->current_forum_id = $forum_id = $attr['forum_id']; 401 402 // Start output buffer 403 $this->start( 'bbp_single_forum' ); 404 } else { 405 // Start output buffer 406 $this->start( 'bbp_topic_form' ); 407 } 408 409 // If the forum id is set, check forum caps else display normal topic form 410 if ( empty( $forum_id ) || bbp_user_can_view_forum( array( 'forum_id' => $forum_id ) ) ) { 411 bbp_get_template_part( 'form', 'topic' ); 412 413 // Forum is private and user does not have caps 414 } elseif ( bbp_is_forum_private( $forum_id, false ) ) { 415 bbp_get_template_part( 'feedback', 'no-access' ); 416 } 417 392 418 // Return contents of output buffer 393 419 return $this->end(); 394 420 } … … 738 764 bbp_get_template_part( 'form', 'user-lost-pass' ); 739 765 else 740 766 bbp_get_template_part( 'feedback', 'logged-in' ); 741 767 742 768 // Return contents of output buffer 743 769 return $this->end(); 744 770 }