Skip to:
Content

BuddyPress.org

Changeset 12327 for branches/4.0


Ignore:
Timestamp:
01/15/2019 10:21:52 PM (21 months 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.

Merges [12327] to the 4.0 branch.

Fixes #8037.

Location:
branches/4.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.0

  • branches/4.0/src/bp-groups/classes/class-bp-groups-group.php

    r11838 r12327  
    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.