Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
06/18/2012 12:43:03 PM (14 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

File:
1 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 . '/' );
Note: See TracChangeset for help on using the changeset viewer.