Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/01/2016 08:09:35 PM (5 years ago)
Author:
boonebgorges
Message:

In bp_get_user_groups(), initialize key whitelists only once.

Creating them during every iteration of the groups loop is unnecessary.

See #7208.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-groups/bp-groups-functions.php

    r10885 r10977  
    876876
    877877    // Normalize group data.
     878    $int_keys  = array( 'id', 'group_id', 'user_id', 'inviter_id' );
     879    $bool_keys = array( 'is_admin', 'is_mod', 'is_confirmed', 'is_banned', 'invite_sent' );
    878880    foreach ( $groups as &$group ) {
    879881        // Integer values.
    880         foreach ( array( 'id', 'group_id', 'user_id', 'inviter_id' ) as $index ) {
     882        foreach ( $int_keys as $index ) {
    881883            $group->{$index} = intval( $group->{$index} );
    882884        }
    883885
    884886        // Boolean values.
    885         foreach ( array( 'is_admin', 'is_mod', 'is_confirmed', 'is_banned', 'invite_sent' ) as $index ) {
     887        foreach ( $bool_keys as $index ) {
    886888            $group->{$index} = (bool) $group->{$index};
    887889        }
Note: See TracChangeset for help on using the changeset viewer.