Skip to:
Content

bbPress.org


Ignore:
Timestamp:
02/26/2017 08:15:20 AM (10 years ago)
Author:
johnjamesjacoby
Message:

Replies: Ensure hierarchical replies are correctly wrapped & concatenated into their output buffers in the correct order.

This updates the walker class to not immediately echo it's contents, and wraps it in an ul element.

Fixes #2757. See #2830.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/common/classes.php

    r6250 r6317  
    326326                                break;
    327327                        case 'ol':
    328                                 echo "<ol class='bbp-threaded-replies'>\n";
     328                                $output .= "<ol class='bbp-threaded-replies'>\n";
    329329                                break;
    330330                        case 'ul':
    331331                        default:
    332                                 echo "<ul class='bbp-threaded-replies'>\n";
     332                                $output .= "<ul class='bbp-threaded-replies'>\n";
    333333                                break;
    334334                }
    … …  
    351351                                break;
    352352                        case 'ol':
    353                                 echo "</ol>\n";
     353                                $output .= "</ol>\n";
    354354                                break;
    355355                        case 'ul':
    356356                        default:
    357                                 echo "</ul>\n";
     357                                $output .= "</ul>\n";
    358358                                break;
    359359                }
    … …  
    401401                // Check for a callback and use it if specified
    402402                if ( ! empty( $args['callback'] ) ) {
     403                        ob_start();
    403404                        call_user_func( $args['callback'], $object, $args, $depth );
     405                        $output .= ob_get_clean();
    404406                        return;
    405407                }
    … …  
    407409                // Style for div or list element
    408410                if ( ! empty( $args['style'] ) && ( 'div' === $args['style'] ) ) {
    409                         echo "<div>\n";
     411                        $output .= "<div>\n";
    410412                } else {
    411                         echo "<li>\n";
    412                 }
    413 
    414                 bbp_get_template_part( 'loop', 'single-reply' );
     413                        $output .= "<li>\n";
     414                }
     415
     416                $output .= bbp_buffer_template_part( 'loop', 'single-reply', false );
    415417        }
    416418
    … …  
    422424                // Check for a callback and use it if specified
    423425                if ( ! empty( $args['end-callback'] ) ) {
     426                        ob_start();
    424427                        call_user_func( $args['end-callback'], $object, $args, $depth );
     428                        $output .= ob_get_clean();
    425429                        return;
    426430                }
    … …  
    428432                // Style for div or list element
    429433                if ( ! empty( $args['style'] ) && ( 'div' === $args['style'] ) ) {
    430                         echo "</div>\n";
     434                        $output .= "</div>\n";
    431435                } else {
    432                         echo "</li>\n";
     436                        $output .= "</li>\n";
    433437                }
    434438        }
    … …  
    536540
    537541                <option class="<?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr( $value ); ?>"<?php selected( $args['selected'], $object->ID ); ?> <?php disabled( in_array( $reply_id, $ancestors ), true ); ?>><?php echo $pad . esc_html( $title ); ?></option>
    538                
     542
    539543                <?php
    540544
Note: See TracChangeset for help on using the changeset viewer.