Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/12/2010 02:14:20 PM (16 years ago)
Author:
apeatling
Message:

Fixing up API so it is consistent for get_users, get_groups and get_blogs.

File:
1 edited

Legend:

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

    r2700 r2702  
    2929        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    3030
    31         switch ( $type ) {
    32             case 'active': default:
    33                 $this->groups = groups_get_active( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    34                 break;
    35 
    36             case 'alphabetical': default:
    37                 $this->groups = groups_get_alphabetically( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    38                 break;
    39 
    40             case 'random':
    41                 $this->groups = groups_get_random_groups( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    42                 break;
    43 
    44             case 'newest':
    45                 $this->groups = groups_get_newest( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    46                 break;
    47 
    48             case 'popular':
    49                 $this->groups = groups_get_popular( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    50                 break;
    51 
    52             case 'most-forum-topics':
    53                 $this->groups = groups_get_by_most_forum_topics( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    54                 break;
    55 
    56             case 'most-forum-posts':
    57                 $this->groups = groups_get_by_most_forum_posts( $this->pag_num, $this->pag_page, $user_id, $search_terms, $populate_extras );
    58                 break;
    59 
    60             case 'invites':
    61                 $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
    62                 break;
    63 
    64             case 'single-group':
    65                 $group = new stdClass;
    66                 $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
    67                 $this->groups = array( $group );
    68                 break;
    69 
    70 
    71             case 'admin-of':
    72                 if ( $user_id )
    73                     $this->groups = groups_get_user_is_admin_of( $user_id, $this->pag_num, $this->pag_page, $search_terms );
    74                 break;
    75 
    76             case 'mod-of':
    77                 if ( $user_id )
    78                     $this->groups = groups_get_user_is_mod_of( $user_id, $this->pag_num, $this->pag_page, $filter );
    79                 break;
    80         }
     31        if ( 'invites' == $type )
     32            $this->groups = groups_get_invites_for_user( $user_id, $this->pag_num, $this->pag_page );
     33        else if ( 'single-group' == $type ) {
     34            $group = new stdClass;
     35            $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
     36            $this->groups = array( $group );
     37        } else
     38            $this->groups = groups_get_groups( array( 'type' => $type, 'per_page' => $this->pag_num, 'page' =>$this->pag_page, 'user_id' => $user_id, 'search_terms' => $search_terms, 'populate_extras' => $populate_extras ) );
    8139
    8240        if ( 'invites' == $type ) {
     
    188146    /* Type */
    189147    if ( 'my-groups' == $bp->current_action ) {
    190         if ( 'recently-joined' == $order )
    191             $type = 'recently-joined';
    192         else if ( 'most-popular' == $order )
     148        if ( 'most-popular' == $order )
    193149            $type = 'popular';
    194         else if ( 'admin-of' == $order ) {
    195             $type = 'admin-of';
    196         } else if ( 'mod-of' == $order ) {
    197             $type = 'mod-of';
    198         } else if ( 'alphabetically' == $order )
     150        else if ( 'alphabetically' == $order )
    199151            $type = 'alphabetical';
    200152    } else if ( 'invites' == $bp->current_action ) {
Note: See TracChangeset for help on using the changeset viewer.