Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/08/2010 12:33:13 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1840

File:
1 edited

Legend:

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

    r2619 r2622  
    258258    /* TODO: Merge all these get_() functions into one. */
    259259
    260     function get_newest( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     260    function get_newest( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    261261        global $wpdb, $bp;
    262262
     
    281281        }
    282282
    283         if ( empty( $user_id ) ) {
     283        if ( !empty( $populate_extras ) ) {
    284284            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    285285            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    290290    }
    291291
    292     function get_active( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     292    function get_active( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    293293        global $wpdb, $bp;
    294294
     
    313313        }
    314314
    315         if ( empty( $user_id ) ) {
     315        if ( !empty( $populate_extras ) ) {
    316316            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    317317            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    322322    }
    323323
    324     function get_popular( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     324    function get_popular( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    325325        global $wpdb, $bp;
    326326
     
    346346        }
    347347
    348         if ( empty( $user_id ) ) {
     348        if ( !empty( $populate_extras ) ) {
    349349            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    350350            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    355355    }
    356356
    357     function get_alphabetically( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     357    function get_alphabetically( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    358358        global $wpdb, $bp;
    359359
     
    378378        }
    379379
    380         if ( empty( $user_id ) ) {
     380        if ( !empty( $populate_extras ) ) {
    381381            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    382382            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    387387    }
    388388
    389     function get_by_most_forum_topics( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     389    function get_by_most_forum_topics( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    390390        global $wpdb, $bp, $bbdb;
    391391
     
    414414        }
    415415
    416         if ( empty( $user_id ) ) {
     416        if ( !empty( $populate_extras ) ) {
    417417            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    418418            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    423423    }
    424424
    425     function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false ) {
     425    function get_by_most_forum_posts( $limit = null, $page = null, $search_terms = false, $populate_extras = true ) {
    426426        global $wpdb, $bp, $bbdb;
    427427
     
    450450        }
    451451
    452         if ( empty( $user_id ) ) {
     452        if ( !empty( $populate_extras ) ) {
    453453            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    454454            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    503503    }
    504504
    505     function get_by_letter( $letter, $limit = null, $page = null ) {
     505    function get_by_letter( $letter, $limit = null, $page = null, $populate_extras = true ) {
    506506        global $wpdb, $bp;
    507507
     
    521521        $paged_groups = $wpdb->get_results( $wpdb->prepare( "SELECT g.*, gm1.meta_value as total_member_count, gm2.meta_value as last_activity FROM {$bp->groups->table_name_groupmeta} gm1, {$bp->groups->table_name_groupmeta} gm2, {$bp->groups->table_name} g WHERE g.id = gm1.group_id AND g.id = gm2.group_id AND gm2.meta_key = 'last_activity' AND gm1.meta_key = 'total_member_count' AND g.name LIKE '$letter%%' {$hidden_sql} {$search_sql} ORDER BY g.name ASC {$pag_sql}"  ) );
    522522
    523         if ( empty( $user_id ) ) {
     523        if ( !empty( $populate_extras ) ) {
    524524            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    525525            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    530530    }
    531531
    532     function get_random( $limit = null, $page = null, $user_id = false, $search_terms = false ) {
     532    function get_random( $limit = null, $page = null, $user_id = false, $search_terms = false, $populate_extras = true ) {
    533533        global $wpdb, $bp;
    534534
     
    553553        }
    554554
    555         if ( empty( $user_id ) ) {
     555        if ( !empty( $populate_extras ) ) {
    556556            foreach ( (array)$paged_groups as $group ) $group_ids[] = $group->id;
    557557            $group_ids = $wpdb->escape( join( ',', (array)$group_ids ) );
     
    765765        $this->inviter_id = 0;
    766766        $this->is_confirmed = 1;
    767         $this->date_modified = time();
     767        $this->date_modified = gmdate( "Y-m-d H:i:s" );
    768768    }
    769769
    770770    function accept_request() {
    771771        $this->is_confirmed = 1;
    772         $this->date_modified = time();
     772        $this->date_modified = gmdate( "Y-m-d H:i:s" );
    773773    }
    774774
Note: See TracChangeset for help on using the changeset viewer.