Skip to:
Content

BuddyPress.org

Changeset 6107


Ignore:
Timestamp:
06/18/2012 12:43:03 PM (12 years ago)
Author:
boonebgorges
Message:

Fixes random group fetching in groups_action_redirect_to_random_group()

At some point, groups_get_group() was changed in such a way that the 'type'
and 'per_page' arguments were removed. This changeset reworks the way that
the group action function fetches a random group, to work around these changes.

Fixes #4269

Location:
trunk/bp-groups
Files:
2 edited

Legend:

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

    r6093 r6107  
    291291}
    292292
     293/**
     294 * Catches requests for a random group page (example.com/groups/?random-group) and redirects
     295 */
    293296function groups_action_redirect_to_random_group() {
    294297
    295298    if ( bp_is_groups_component() && isset( $_GET['random-group'] ) ) {
    296         $group = groups_get_groups( array( 'type' => 'random', 'per_page' => 1 ) );
     299        $group = BP_Groups_Group::get_random( 1, 1 );
    297300
    298301        bp_core_redirect( bp_get_root_domain() . '/' . bp_get_groups_root_slug() . '/' . $group['groups'][0]->slug . '/' );
  • trunk/bp-groups/bp-groups-classes.php

    r6100 r6107  
    556556        global $wpdb, $bp;
    557557
     558        $pag_sql = $hidden_sql = $search_sql = $exclude_sql = '';
     559
    558560        if ( !empty( $limit ) && !empty( $page ) )
    559561            $pag_sql = $wpdb->prepare( " LIMIT %d, %d", intval( ( $page - 1 ) * $limit), intval( $limit ) );
Note: See TracChangeset for help on using the changeset viewer.