Skip to:
Content

BuddyPress.org

Changeset 8580


Ignore:
Timestamp:
07/10/2014 04:14:26 PM (12 years ago)
Author:
johnjamesjacoby
Message:

Reduce indentation in bp_blogs_record_existing_blogs().

File:
1 edited

Legend:

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

    r8343 r8580  
    8181    }
    8282
    83     if ( !empty( $blog_ids ) ) {
    84         foreach( (array) $blog_ids as $blog_id ) {
    85             $users       = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID' ) );
    86             $subscribers = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID', 'role' => 'subscriber' ) );
    87 
    88             if ( !empty( $users ) ) {
    89                 foreach ( (array) $users as $user ) {
    90                     // Don't record blogs for subscribers
    91                     if ( !in_array( $user, $subscribers ) ) {
    92                         bp_blogs_record_blog( $blog_id, $user, true );
    93                     }
     83    // Bail if there are no blogs in the network
     84    if ( empty( $blog_ids ) ) {
     85        return;
     86    }
     87
     88    // Loop through users of blogs and record them
     89    foreach( (array) $blog_ids as $blog_id ) {
     90        $users       = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID' ) );
     91        $subscribers = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ID', 'role' => 'subscriber' ) );
     92
     93        if ( !empty( $users ) ) {
     94            foreach ( (array) $users as $user ) {
     95                // Don't record blogs for subscribers
     96                if ( !in_array( $user, $subscribers ) ) {
     97                    bp_blogs_record_blog( $blog_id, $user, true );
    9498                }
    9599            }
Note: See TracChangeset for help on using the changeset viewer.