BUG in bp_remove_member_type
-
Hi all,
there is a huge bug in bp_remove_member_type which can potentially break the page in PHP 8:
This piece of code:
// No need to continue if the member doesn't have the type. $existing_types = bp_get_member_type( $user_id, false ); if ( ! in_array( $member_type, $existing_types, true ) ) { return false; }
breaks if a user has NO membertype, because bp_get_member_type can return false instead of an empty array. So either check whether $existing_types is_array()…
OR: Fix bp_get_member_type(), so that if $single=false, that it returns an empty array instead of false…
Nasty BUG!
In the meantime I fixed it using functions like this:add_filter('bp_get_member_type', function($type, $user_id, $single) { if(!$single && !is_array($type)) return array($type); return $type; }, 99, 3);
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.