Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/11/2012 09:32:04 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Breathing room for cast variables.

File:
1 edited

Legend:

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

    r5714 r5729  
    6262            // Get group admins and mods
    6363            $admin_mods = $wpdb->get_results( apply_filters( 'bp_group_admin_mods_user_join_filter', $wpdb->prepare( "SELECT u.ID as user_id, u.user_login, u.user_email, u.user_nicename, m.is_admin, m.is_mod FROM {$wpdb->users} u, {$bp->groups->table_name_members} m WHERE u.ID = m.user_id AND m.group_id = %d AND ( m.is_admin = 1 OR m.is_mod = 1 )", $this->id ) ) );
    64             foreach( (array)$admin_mods as $user ) {
     64            foreach( (array) $admin_mods as $user ) {
    6565                if ( (int) $user->is_admin )
    6666                    $this->admins[] = $user;
     
    150150        // Fetch the user IDs of all the members of the group
    151151        $user_ids = BP_Groups_Member::get_group_member_ids( $this->id );
    152         $user_ids = implode( ',', (array)$user_ids );
     152        $user_ids = implode( ',', (array) $user_ids );
    153153
    154154        // Modify group count usermeta for members
     
    350350
    351351        // Get paginated results
    352         $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array)$sql ), $sql );
     352        $paged_groups_sql = apply_filters( 'bp_groups_get_paged_groups_sql', join( ' ', (array) $sql ), $sql );
    353353        $paged_groups     = $wpdb->get_results( $paged_groups_sql );
    354354
     
    382382
    383383        if ( !empty( $total_sql['where'] ) )
    384             $t_sql .= " WHERE " . join( ' AND ', (array)$total_sql['where'] );
     384            $t_sql .= " WHERE " . join( ' AND ', (array) $total_sql['where'] );
    385385
    386386        // Get total group results
    387         $total_groups_sql = apply_filters( 'bp_groups_get_total_groups_sql', join( ' ', (array)$t_sql ), $t_sql );
     387        $total_groups_sql = apply_filters( 'bp_groups_get_total_groups_sql', join( ' ', (array) $t_sql ), $t_sql );
    388388        $total_groups     = $wpdb->get_var( $total_groups_sql );
    389389
    390390        $group_ids = array();
    391         foreach ( (array)$paged_groups as $group ) {
     391        foreach ( (array) $paged_groups as $group ) {
    392392            $group_ids[] = $group->id;
    393393        }
     
    395395        // Populate some extra information instead of querying each time in the loop
    396396        if ( !empty( $populate_extras ) ) {
    397             $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     397            $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    398398            $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, $type );
    399399        }
     
    440440
    441441        if ( !empty( $populate_extras ) ) {
    442             foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    443             $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     442            foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     443            $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    444444            $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    445445        }
     
    481481
    482482        if ( !empty( $populate_extras ) ) {
    483             foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    484             $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     483            foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     484            $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    485485            $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    486486        }
     
    521521
    522522        if ( !empty( $populate_extras ) ) {
    523             foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    524             $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     523            foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     524            $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    525525            $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    526526        }
     
    558558
    559559        if ( !empty( $populate_extras ) ) {
    560             foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    561             $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     560            foreach ( (array) $paged_groups as $group ) $group_ids[] = $group->id;
     561            $group_ids = $wpdb->escape( join( ',', (array) $group_ids ) );
    562562            $paged_groups = BP_Groups_Group::get_group_extras( $paged_groups, $group_ids, 'newest' );
    563563        }
     
    577577            $paged_groups[$i]->is_member = false;
    578578
    579             foreach ( (array)$user_status as $group_id ) {
     579            foreach ( (array) $user_status as $group_id ) {
    580580                if ( $group_id == $paged_groups[$i]->id ) {
    581581                    $paged_groups[$i]->is_member = true;
     
    588588            $paged_groups[$i]->is_banned = false;
    589589
    590             foreach ( (array)$user_banned as $group_id ) {
     590            foreach ( (array) $user_banned as $group_id ) {
    591591                if ( $group_id == $paged_groups[$i]->id ) {
    592592                    $paged_groups[$i]->is_banned = true;
     
    11491149
    11501150        // Fetch whether or not the user is a friend
    1151         foreach ( (array)$members as $user )
     1151        foreach ( (array) $members as $user )
    11521152            $user_ids[] = $user->user_id;
    11531153
     
    11571157            $friend_status = $wpdb->get_results( $wpdb->prepare( "SELECT initiator_user_id, friend_user_id, is_confirmed FROM {$bp->friends->table_name} WHERE (initiator_user_id = %d AND friend_user_id IN ( {$user_ids} ) ) OR (initiator_user_id IN ( {$user_ids} ) AND friend_user_id = %d )", bp_loggedin_user_id(), bp_loggedin_user_id() ) );
    11581158            for ( $i = 0, $count = count( $members ); $i < $count; ++$i ) {
    1159                 foreach ( (array)$friend_status as $status ) {
     1159                foreach ( (array) $friend_status as $status ) {
    11601160                    if ( $status->initiator_user_id == $members[$i]->user_id || $status->friend_user_id == $members[$i]->user_id ) {
    11611161                        $members[$i]->is_friend = $status->is_confirmed;
Note: See TracChangeset for help on using the changeset viewer.