Skip to:
Content

bbPress.org

Changeset 5394


Ignore:
Timestamp:
06/12/2014 09:36:00 PM (5 years ago)
Author:
johnjamesjacoby
Message:

Smarter ancestor detection in BBP_Walker_Reply_Dropdown. See #2617.

File:
1 edited

Legend:

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

    r5391 r5394  
    502502        $depth++;
    503503
    504         // Get reply ancestors
    505         $to_check = bbp_get_reply_ancestors( $object->ID );
    506 
    507         // Array of ancestors to check for disabling
    508         if ( $args['selected'] !== $object->ID ) {
    509             array_unshift( $to_check, $object->ID );
    510         }
     504        // Get ancestors to determine which items to disable
     505        $ancestors = bbp_get_reply_ancestors( $object->ID );
     506        array_push( $ancestors, $object->ID );
    511507
    512508        // Determine the indentation
     
    525521        ob_start(); ?>
    526522
    527         <option class="<?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr( $value ); ?>"<?php selected( $args['selected'], $object->ID ); ?> <?php disabled( in_array( $args['selected'], $to_check ), true ); ?>><?php echo $pad . esc_html( $title ); ?></option>
     523        <option class="<?php echo esc_attr( $class ); ?>" value="<?php echo esc_attr( $value ); ?>"<?php selected( $args['selected'], $object->ID ); ?> <?php disabled( in_array( bbp_get_reply_id(), $ancestors ), true ); ?>><?php echo $pad . esc_html( $title ); ?></option>
    528524       
    529525        <?php
Note: See TracChangeset for help on using the changeset viewer.