Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/15/2019 10:20:11 PM (8 years ago)
Author:
boonebgorges
Message:

Improve parent_id parsing in BP_Groups_Group.

The previous logic depended on behavior in wp_parse_id_list() that
will change in WP 5.1.

Fixes #8037.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/classes/class-bp-groups-group.php

    r11838 r12326  
    12031203
    12041204                if ( ! is_null( $r['parent_id'] ) ) {
    1205                         // Note that `wp_parse_id_list()` converts `false` to 0.
    1206                         $parent_id        = implode( ',', wp_parse_id_list( $r['parent_id'] ) );
     1205                        // For legacy reasons, `false` means groups with no parent.
     1206                        if ( false === $r['parent_id'] ) {
     1207                                $parent_id = 0;
     1208                        } else {
     1209                                $parent_id = implode( ',', wp_parse_id_list( $r['parent_id'] ) );
     1210                        }
     1211
    12071212                        $where_conditions['parent_id'] = "g.parent_id IN ({$parent_id})";
    12081213                }
Note: See TracChangeset for help on using the changeset viewer.