Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/02/2009 07:54:21 PM (15 years ago)
Author:
apeatling
Message:

Merging 1.1 branch changes and syncing.

File:
1 edited

Legend:

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

    r2055 r2077  
    99    <li<?php if ( 'admin-of' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/admin-of""><?php _e( 'Administrator Of', 'buddypress' ) ?></a></li>
    1010    <li<?php if ( 'mod-of' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/mod-of""><?php _e( 'Moderator Of', 'buddypress' ) ?></a></li>
    11     <li<?php if ( 'alphabetically' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>   
     11    <li<?php if ( 'alphabetically' == $bp->action_variables[0] ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->displayed_user->domain . $bp->groups->slug ?>/my-groups/alphabetically""><?php _e( 'Alphabetically', 'buddypress' ) ?></a></li>
    1212<?php
    1313    do_action( 'groups_header_tabs' );
     
    1616function bp_groups_filter_title() {
    1717    global $bp;
    18    
     18
    1919    $current_filter = $bp->action_variables[0];
    20    
     20
    2121    switch ( $current_filter ) {
    2222        case 'recently-active': default:
     
    4444function bp_is_group_admin_screen( $slug ) {
    4545    global $bp;
    46    
     46
    4747    if ( $bp->current_component != BP_GROUPS_SLUG || 'admin' != $bp->current_action )
    4848        return false;
    49    
     49
    5050    if ( $bp->action_variables[0] == $slug )
    5151        return true;
    52    
     52
    5353    return false;
    5454}
     
    5656function bp_group_current_avatar() {
    5757    global $bp;
    58    
     58
    5959    if ( $bp->groups->current_group->avatar_full ) { ?>
    6060        <img src="<?php echo attribute_escape( $bp->groups->current_group->avatar_full ) ?>" alt="<?php _e( 'Group Avatar', 'buddypress' ) ?>" class="avatar" />
     
    7070    if ( !empty( $_FILES ) || !bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'no_grav' => true ) ) )
    7171        return false;
    72    
     72
    7373    return true;
    7474}
     
    7979    function bp_get_group_avatar_delete_link() {
    8080        global $bp;
    81        
     81
    8282        return apply_filters( 'bp_get_group_avatar_delete_link', wp_nonce_url( bp_get_group_permalink( $bp->groups->current_group ) . '/admin/group-avatar/delete', 'bp_group_avatar_delete' ) );
    8383    }
     
    113113    var $groups;
    114114    var $group;
    115    
     115
    116116    var $in_the_loop;
    117    
     117
    118118    var $pag_page;
    119119    var $pag_num;
    120120    var $pag_links;
    121121    var $total_group_count;
    122    
     122
    123123    var $single_group = false;
    124    
     124
    125125    var $sort_by;
    126126    var $order;
    127    
     127
    128128    function bp_groups_user_groups_template( $user_id, $type, $per_page, $max, $slug, $filter ) {
    129129        global $bp;
    130        
     130
    131131        if ( !$user_id )
    132132            $user_id = $bp->displayed_user->id;
    133        
     133
    134134        $this->pag_page = isset( $_REQUEST['grpage'] ) ? intval( $_REQUEST['grpage'] ) : 1;
    135135        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
     
    141141
    142142            case 'popular':
    143                 $this->groups = groups_get_most_popular_for_user( $user_id, $this->pag_num, $this->pag_page, $filter );             
     143                $this->groups = groups_get_most_popular_for_user( $user_id, $this->pag_num, $this->pag_page, $filter );
    144144                break;
    145145
    146146            case 'admin-of':
    147                 $this->groups = groups_get_user_is_admin_of( $user_id, $this->pag_num, $this->pag_page, $filter );             
    148                 break; 
     147                $this->groups = groups_get_user_is_admin_of( $user_id, $this->pag_num, $this->pag_page, $filter );
     148                break;
    149149
    150150            case 'mod-of':
    151                 $this->groups = groups_get_user_is_mod_of( $user_id, $this->pag_num, $this->pag_page, $filter );               
     151                $this->groups = groups_get_user_is_mod_of( $user_id, $this->pag_num, $this->pag_page, $filter );
    152152                break;
    153153
    154154            case 'alphabetical':
    155                 $this->groups = groups_get_alphabetically_for_user( $user_id, $this->pag_num, $this->pag_page, $filter );   
     155                $this->groups = groups_get_alphabetically_for_user( $user_id, $this->pag_num, $this->pag_page, $filter );
    156156                break;
    157157
     
    162162            case 'single-group':
    163163                $group = new stdClass;
    164                 $group->group_id = BP_Groups_Group::get_id_from_slug($slug);           
     164                $group->group_id = BP_Groups_Group::get_id_from_slug($slug);
    165165                $this->groups = array( $group );
    166166                break;
     
    170170                break;
    171171        }
    172        
     172
    173173        if ( 'invites' == $type ) {
    174174            $this->total_group_count = count($this->groups);
     
    210210        if ( $this->group_count )
    211211            return true;
    212        
     212
    213213        return false;
    214214    }
    215    
     215
    216216    function next_group() {
    217217        $this->current_group++;
    218218        $this->group = $this->groups[$this->current_group];
    219            
     219
    220220        return $this->group;
    221221    }
    222    
     222
    223223    function rewind_groups() {
    224224        $this->current_group = -1;
     
    227227        }
    228228    }
    229    
    230     function user_groups() { 
     229
     230    function user_groups() {
    231231        if ( $this->current_group + 1 < $this->group_count ) {
    232232            return true;
     
    240240        return false;
    241241    }
    242    
     242
    243243    function the_group() {
    244244        global $group;
     
    246246        $this->in_the_loop = true;
    247247        $this->group = $this->next_group();
    248        
     248
    249249        // If this is a single group then instantiate group meta when creating the object.
    250250        if ( $this->single_group ) {
     
    259259            }
    260260        }
    261        
     261
    262262        $this->group = $group;
    263        
     263
    264264        if ( 0 == $this->current_group ) // loop has just started
    265265            do_action('loop_start');
     
    269269function bp_has_groups( $args = '' ) {
    270270    global $groups_template, $bp;
    271    
     271
    272272    $defaults = array(
    273273        'type' => 'active',
     
    281281    $r = wp_parse_args( $args, $defaults );
    282282    extract( $r, EXTR_SKIP );
    283    
     283
    284284    /* The following code will auto set parameters based on the page being viewed.
    285285     * for example on example.com/members/andy/groups/my-groups/most-popular/
     
    304304        $slug = $bp->groups->current_group->slug;
    305305    }
    306    
     306
    307307    if ( isset( $_REQUEST['group-filter-box'] ) )
    308308        $filter = $_REQUEST['group-filter-box'];
    309    
     309
    310310    $groups_template = new BP_Groups_User_Groups_Template( $user_id, $type, $per_page, $max, $slug, $filter );
    311311    return apply_filters( 'bp_has_groups', $groups_template->has_groups(), &$groups_template );
     
    324324function bp_group_is_visible( $group = false ) {
    325325    global $bp, $groups_template;
    326    
     326
    327327    if ( !$group )
    328328        $group =& $groups_template->group;
    329        
     329
    330330    if ( 'public' == $group->status ) {
    331331        return true;
     
    335335        }
    336336    }
    337    
     337
    338338    return false;
    339339}
     
    341341function bp_group_has_news( $group = false ) {
    342342    global $groups_template;
    343    
     343
    344344    if ( !$group )
    345345        $group =& $groups_template->group;
    346    
     346
    347347    if ( empty( $group->news ) )
    348348        return false;
    349    
     349
    350350    return true;
    351351}
     
    367367        return apply_filters( 'bp_get_group_id', $group->id );
    368368    }
    369    
     369
    370370function bp_group_name( $deprecated = true, $deprecated2 = false ) {
    371371    global $groups_template;
     
    396396        if ( 'public' == $group->status ) {
    397397            $type = __( "Public Group", "buddypress" );
    398         } else if ( 'hidden' == $group->status ) { 
     398        } else if ( 'hidden' == $group->status ) {
    399399            $type = __( "Hidden Group", "buddypress" );
    400400        } else if ( 'private' == $group->status ) {
     
    404404        }
    405405
    406         return apply_filters( 'bp_get_group_type', $type ); 
     406        return apply_filters( 'bp_get_group_type', $type );
    407407    }
    408408
     
    416416            $group =& $groups_template->group;
    417417
    418         return apply_filters( 'bp_get_group_status', $group->status ); 
     418        return apply_filters( 'bp_get_group_status', $group->status );
    419419    }
    420420
     
    431431            'class' => 'avatar',
    432432            'id' => false,
    433             'alt' => __( 'Group avatar', 'buddypress' ) 
     433            'alt' => __( 'Group avatar', 'buddypress' )
    434434        );
    435435
    436436        $r = wp_parse_args( $args, $defaults );
    437437        extract( $r, EXTR_SKIP );
    438    
     438
    439439        /* Fetch the avatar from the folder, if not provide backwards compat. */
    440440        if ( !$avatar = bp_core_fetch_avatar( array( 'item_id' => $groups_template->group->id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'css_id' => $id, 'class' => $class, 'width' => $width, 'height' => $height ) ) )
     
    462462        return bp_get_group_last_active();
    463463    else
    464         echo bp_get_group_last_active();           
     464        echo bp_get_group_last_active();
    465465}
    466466    function bp_get_group_last_active( $group = false ) {
     
    475475            return __( 'not yet active', 'buddypress' );
    476476        } else {
    477             return apply_filters( 'bp_get_group_last_active', bp_core_time_since( $last_active ) );         
    478         }
    479     }
    480    
     477            return apply_filters( 'bp_get_group_last_active', bp_core_time_since( $last_active ) );
     478        }
     479    }
     480
    481481function bp_group_permalink( $deprecated = false, $deprecated2 = true ) {
    482482    if ( !$deprecated2 )
     
    506506            $group =& $groups_template->group;
    507507
    508         return apply_filters( 'bp_get_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug . '/admin' ); 
     508        return apply_filters( 'bp_get_group_admin_permalink', $bp->root_domain . '/' . $bp->groups->slug . '/' . $group->slug . '/admin' );
    509509    }
    510510
     
    557557            $group =& $groups_template->group;
    558558
    559         return apply_filters( 'bp_get_group_description_excerpt', bp_create_excerpt( $group->description, 20 ) );   
     559        return apply_filters( 'bp_get_group_description_excerpt', bp_create_excerpt( $group->description, 20 ) );
    560560    }
    561561
     
    599599        }
    600600    }
    601    
     601
    602602function bp_group_is_public( $deprecated = false ) {
    603603    echo bp_get_group_is_public();
     
    626626function bp_group_is_admin() {
    627627    global $bp;
    628    
     628
    629629    return $bp->is_item_admin;
    630630}
     
    632632function bp_group_is_mod() {
    633633    global $bp;
    634    
     634
    635635    return $bp->is_item_mod;
    636636}
     
    638638function bp_group_list_admins( $full_list = true, $group = false ) {
    639639    global $groups_template;
    640    
     640
    641641    if ( !$group )
    642642        $group =& $groups_template->group;
    643    
     643
    644644    if ( !$admins = &$group->admins )
    645645        $admins = $group->get_administrators();
     
    665665        <span class="activity"><?php _e( 'No Admins', 'buddypress' ) ?></span>
    666666    <?php } ?>
    667    
     667
    668668<?php
    669669}
     
    671671function bp_group_list_mods( $full_list = true, $group = false ) {
    672672    global $groups_template;
    673    
     673
    674674    if ( !$group )
    675675        $group =& $groups_template->group;
    676    
     676
    677677    $group_mods = groups_get_group_mods( $group->id );
    678    
     678
    679679    if ( $group_mods ) {
    680680        if ( $full_list ) { ?>
     
    697697        <span class="activity"><?php _e( 'No Mods', 'buddypress' ) ?></span>
    698698    <?php } ?>
    699    
     699
    700700<?php
    701701}
     
    706706    if ( !$group )
    707707        $group =& $groups_template->group;
    708    
     708
    709709    if ( !$deprecated )
    710710        return bp_get_group_all_members_permalink();
     
    731731        <label for="<?php echo $name ?>" id="<?php echo $name ?>-label"><?php echo $label ?></label>
    732732        <input type="search" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo $value ?>"<?php echo $disabled ?> />
    733    
     733
    734734        <?php wp_nonce_field( 'group-filter-box', '_wpnonce_group_filter' ) ?>
    735735    </form>
     
    739739function bp_group_show_no_groups_message() {
    740740    global $bp;
    741    
     741
    742742    if ( !groups_total_groups_for_user( $bp->displayed_user->id ) )
    743743        return true;
    744        
     744
    745745    return false;
    746746}
     
    751751    function bp_get_group_pagination() {
    752752        global $groups_template;
    753        
     753
    754754        return apply_filters( 'bp_get_group_pagination', $groups_template->pag_links );
    755755    }
     
    762762
    763763    echo sprintf( __( 'Viewing group %d to %d (of %d groups)', 'buddypress' ), $from_num, $to_num, $groups_template->total_group_count ); ?> &nbsp;
    764     <span class="ajax-loader"></span><?php 
     764    <span class="ajax-loader"></span><?php
    765765}
    766766
     
    804804    if ( !$group )
    805805        $group =& $groups_template->group;
    806    
     806
    807807    if ( $group->enable_wire )
    808808        return true;
    809    
     809
    810810    return false;
    811811}
     
    833833            if ( $group->enable_forum )
    834834                return true;
    835            
     835
    836836            return false;
    837837        } else {
     
    839839        }
    840840    }
    841    
    842     return false;   
     841
     842    return false;
    843843}
    844844
     
    848848    if ( !$group )
    849849        $group =& $groups_template->group;
    850    
     850
    851851    if ( $group->enable_forum )
    852852        echo ' checked="checked"';
     
    858858    if ( !$group )
    859859        $group =& $groups_template->group;
    860    
     860
    861861    if ( $setting == $group->status )
    862862        echo ' checked="checked"';
     
    865865function bp_group_admin_memberlist( $admin_list = false, $group = false ) {
    866866    global $groups_template;
    867    
     867
    868868    if ( !$group )
    869869        $group =& $groups_template->group;
    870    
     870
    871871    $admins = groups_get_group_admins( $group->id );
    872872?>
     
    884884                <h5><?php echo bp_core_get_userlink( $admin->user_id ) ?></h5>
    885885                <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $admin->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span>
    886                
     886
    887887                <?php if ( function_exists( 'friends_install' ) ) : ?>
    888888                    <div class="action">
     
    890890                    </div>
    891891                <?php endif; ?>
    892             </li>       
     892            </li>
    893893            <?php } ?>
    894894        <?php } ?>
     
    902902
    903903function bp_group_mod_memberlist( $admin_list = false, $group = false ) {
    904     global $groups_template, $group_mods;   
     904    global $groups_template, $group_mods;
    905905
    906906    if ( !$group )
    907907        $group =& $groups_template->group;
    908    
     908
    909909    $group_mods = groups_get_group_mods( $group->id );
    910910    ?>
     
    922922                    <h5><?php echo bp_core_get_userlink( $mod->user_id ) ?></h5>
    923923                    <span class="activity"><?php echo bp_core_get_last_activity( strtotime( $mod->date_modified ), __( 'joined %s ago', 'buddypress') ); ?></span>
    924                    
     924
    925925                    <?php if ( function_exists( 'friends_install' ) ) : ?>
    926926                        <div class="action">
     
    928928                        </div>
    929929                    <?php endif; ?>
    930                 </li>       
    931                 <?php } ?>         
     930                </li>
     931                <?php } ?>
    932932            <?php } ?>
    933933            </ul>
     
    10011001        return apply_filters( 'bp_get_group_member_demote_link', wp_nonce_url( bp_get_group_permalink( $group ) . '/admin/manage-members/demote/' . $user_id, 'groups_demote_member' ) );
    10021002    }
    1003    
     1003
    10041004function bp_group_member_ban_link( $user_id = false, $deprecated = false ) {
    10051005    global $members_template;
     
    10241024    if ( !$user_id )
    10251025        $user_id = $members_template->member->user_id;
    1026    
    1027     echo bp_get_group_member_unban_link( $user_id );   
     1026
     1027    echo bp_get_group_member_unban_link( $user_id );
    10281028}
    10291029    function bp_get_group_member_unban_link( $user_id = false, $group = false ) {
     
    10321032        if ( !$user_id )
    10331033            $user_id = $members_template->member->user_id;
    1034        
    1035         if ( !$group )
    1036             $group =& $groups_template->group;
    1037 
    1038         return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( bp_get_group_permalink( $group ) . '/admin/manage-members/unban/' . $user_id, 'groups_unban_member' ) ); 
     1034
     1035        if ( !$group )
     1036            $group =& $groups_template->group;
     1037
     1038        return apply_filters( 'bp_get_group_member_unban_link', wp_nonce_url( bp_get_group_permalink( $group ) . '/admin/manage-members/unban/' . $user_id, 'groups_unban_member' ) );
    10391039    }
    10401040
     
    10441044    if ( !$group )
    10451045        $group = ( $groups_template->group ) ? $groups_template->group : $bp->groups->current_group;
    1046    
     1046
    10471047    $current_tab = $bp->action_variables[0];
    10481048?>
     
    10501050        <li<?php if ( 'edit-details' == $current_tab || empty( $current_tab ) ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/edit-details"><?php _e('Edit Details', 'buddypress') ?></a></li>
    10511051    <?php } ?>
    1052    
     1052
    10531053    <?php
    10541054        if ( !$bp->is_item_admin )
     
    10621062        <li<?php if ( 'membership-requests' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/membership-requests"><?php _e('Membership Requests', 'buddypress') ?></a></li>
    10631063    <?php endif; ?>
    1064    
     1064
    10651065    <?php do_action( 'groups_admin_tabs', $current_tab, $group->slug ) ?>
    1066    
     1066
    10671067    <li<?php if ( 'delete-group' == $current_tab ) : ?> class="current"<?php endif; ?>><a href="<?php echo $bp->root_domain . '/' . $bp->groups->slug ?>/<?php echo $group->slug ?>/admin/delete-group"><?php _e('Delete Group', 'buddypress') ?></a></li>
    10681068<?php
     
    10871087        return apply_filters( 'bp_group_form_action', bp_get_group_permalink( $group ) . '/' . $page );
    10881088    }
    1089    
     1089
    10901090function bp_group_admin_form_action( $page = false, $deprecated = false ) {
    10911091    echo bp_get_group_admin_form_action( $page );
     
    11051105function bp_group_has_requested_membership( $group = false ) {
    11061106    global $bp, $groups_template;
    1107    
     1107
    11081108    if ( !$group )
    11091109        $group =& $groups_template->group;
    1110    
     1110
    11111111    if ( groups_check_for_membership_request( $bp->loggedin_user->id, $group->id ) )
    11121112        return true;
    1113    
     1113
    11141114    return false;
    11151115}
     
    11201120    if ( !$group )
    11211121        $group =& $groups_template->group;
    1122    
     1122
    11231123    if ( groups_is_user_member( $bp->loggedin_user->id, $group->id ) )
    11241124        return true;
    1125    
     1125
    11261126    return false;
    11271127}
     
    11361136            $group =& $groups_template->group;
    11371137
    1138         return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/invites/accept/' . $group->id, 'groups_accept_invite' ) );   
     1138        return apply_filters( 'bp_get_group_accept_invite_link', wp_nonce_url( $bp->loggedin_user->domain . $bp->groups->slug . '/invites/accept/' . $group->id, 'groups_accept_invite' ) );
    11391139    }
    11401140
     
    11601160            $group =& $groups_template->group;
    11611161
    1162         return apply_filters( 'bp_group_leave_confirm_link', wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group/yes', 'groups_leave_group' ) ); 
     1162        return apply_filters( 'bp_group_leave_confirm_link', wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group/yes', 'groups_leave_group' ) );
    11631163    }
    11641164
     
    11891189function bp_has_friends_to_invite( $group = false ) {
    11901190    global $groups_template, $bp;
    1191    
     1191
    11921192    if ( !function_exists('friends_install') )
    11931193        return false;
     
    11951195    if ( !$group )
    11961196        $group =& $groups_template->group;
    1197    
     1197
    11981198    if ( !friends_check_user_has_friends( $bp->loggedin_user->id ) || !friends_count_invitable_friends( $bp->loggedin_user->id, $group->id ) )
    11991199        return false;
    1200    
     1200
    12011201    return true;
    12021202}
     
    12041204function bp_group_join_button( $group = false ) {
    12051205    global $bp, $groups_template;
    1206    
     1206
    12071207    if ( !$group )
    12081208        $group =& $groups_template->group;
    1209    
     1209
    12101210    // If they're not logged in or are banned from the group, no join button.
    12111211    if ( !is_user_logged_in() || groups_is_user_banned( $bp->loggedin_user->id, $group->id ) )
     
    12141214    if ( !$group->status )
    12151215        return false;
    1216    
     1216
    12171217    echo '<div class="generic-button group-button ' . $group->status . '" id="groupbutton-' . $group->id . '">';
    1218    
     1218
    12191219    switch ( $group->status ) {
    12201220        case 'public':
    12211221            if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) )
    1222                 echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';                                 
     1222                echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    12231223            else
    1224                 echo '<a class="join-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';                   
     1224                echo '<a class="join-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/join', 'groups_join_group' ) . '">' . __( 'Join Group', 'buddypress' ) . '</a>';
    12251225        break;
    1226        
     1226
    12271227        case 'private':
    12281228            if ( BP_Groups_Member::check_is_member( $bp->loggedin_user->id, $group->id ) ) {
    1229                 echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';                                     
     1229                echo '<a class="leave-group" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/leave-group', 'groups_leave_group' ) . '">' . __( 'Leave Group', 'buddypress' ) . '</a>';
    12301230            } else {
    12311231                if ( !bp_group_has_requested_membership( $group ) )
    1232                     echo '<a class="request-membership" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/request-membership', 'groups_request_membership' ) . '">' . __('Request Membership', 'buddypress') . '</a>';       
     1232                    echo '<a class="request-membership" href="' . wp_nonce_url( bp_get_group_permalink( $group ) . '/request-membership', 'groups_request_membership' ) . '">' . __('Request Membership', 'buddypress') . '</a>';
    12331233                else
    1234                     echo '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';             
     1234                    echo '<a class="membership-requested" href="' . bp_get_group_permalink( $group ) . '">' . __( 'Request Sent', 'buddypress' ) . '</a>';
    12351235            }
    12361236        break;
    12371237    }
    1238    
     1238
    12391239    echo '</div>';
    12401240}
     
    12421242function bp_group_status_message( $group = false ) {
    12431243    global $groups_template;
    1244    
     1244
    12451245    if ( !$group )
    12461246        $group =& $groups_template->group;
    1247    
     1247
    12481248    if ( 'private' == $group->status ) {
    12491249        if ( !bp_group_has_requested_membership() )
     
    12521252            else
    12531253                _e( 'This is a private group. To join you must be a registered site member and request group membership.', 'buddypress' );
    1254         else 
    1255             _e( 'This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress' );         
     1254        else
     1255            _e( 'This is a private group. Your membership request is awaiting approval from the group administrator.', 'buddypress' );
    12561256    } else {
    12571257        _e( 'This is a hidden group and only invited members can join.', 'buddypress' );
     
    12691269    var $members;
    12701270    var $member;
    1271    
     1271
    12721272    var $in_the_loop;
    1273    
     1273
    12741274    var $pag_page;
    12751275    var $pag_num;
    12761276    var $pag_links;
    12771277    var $total_group_count;
    1278    
     1278
    12791279    function bp_groups_group_members_template( $group_id, $per_page, $max, $exclude_admins_mods, $exclude_banned ) {
    12801280        global $bp;
    1281        
     1281
    12821282        $this->pag_page = isset( $_REQUEST['mlpage'] ) ? intval( $_REQUEST['mlpage'] ) : 1;
    12831283        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    1284        
     1284
    12851285        $this->members = BP_Groups_Member::get_all_for_group( $group_id, $this->pag_num, $this->pag_page, $exclude_admins_mods, $exclude_banned );
    1286        
     1286
    12871287        if ( !$max || $max >= (int)$this->members['count'] )
    12881288            $this->total_member_count = (int)$this->members['count'];
     
    12911291
    12921292        $this->members = $this->members['members'];
    1293        
     1293
    12941294        if ( $max ) {
    12951295            if ( $max >= count($this->members) )
     
    13111311        ));
    13121312    }
    1313    
     1313
    13141314    function has_members() {
    13151315        if ( $this->member_count )
     
    13181318        return false;
    13191319    }
    1320    
     1320
    13211321    function next_member() {
    13221322        $this->current_member++;
    13231323        $this->member = $this->members[$this->current_member];
    1324        
     1324
    13251325        return $this->member;
    13261326    }
    1327    
     1327
    13281328    function rewind_members() {
    13291329        $this->current_member = -1;
     
    13321332        }
    13331333    }
    1334    
    1335     function members() { 
     1334
     1335    function members() {
    13361336        if ( $this->current_member + 1 < $this->member_count ) {
    13371337            return true;
     
    13451345        return false;
    13461346    }
    1347    
     1347
    13481348    function the_member() {
    13491349        global $member;
     
    13591359function bp_group_has_members( $args = '' ) {
    13601360    global $bp, $members_template;
    1361    
     1361
    13621362    $defaults = array(
    13631363        'group_id' => $bp->groups->current_group->id,
     
    13771377function bp_group_members() {
    13781378    global $members_template;
    1379    
     1379
    13801380    return $members_template->members();
    13811381}
     
    13831383function bp_group_the_member() {
    13841384    global $members_template;
    1385    
     1385
    13861386    return $members_template->the_member();
    13871387}
     
    14401440        return apply_filters( 'bp_get_group_member_link', bp_core_get_userlink( $members_template->member->user_id ) );
    14411441    }
    1442    
     1442
    14431443function bp_group_member_is_banned() {
    14441444    echo bp_get_group_member_is_banned();
     
    14581458        return apply_filters( 'bp_get_group_member_joined_since', bp_core_get_last_activity( strtotime( $members_template->member->date_modified ), __( 'joined %s ago', 'buddypress') ) );
    14591459    }
    1460    
     1460
    14611461function bp_group_member_id() {
    14621462    echo bp_get_group_member_id();
     
    14731473    if ( $members_template->total_member_count > $members_template->pag_num )
    14741474        return true;
    1475    
     1475
    14761476    return false;
    14771477}
     
    15021502
    15031503        $from_num = intval( ( $members_template->pag_page - 1 ) * $members_template->pag_num ) + 1;
    1504         $to_num = ( $from_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $from_num + ( $members_template->pag_num - 1 ); 
    1505 
    1506         return apply_filters( 'bp_get_group_member_pagination_count', sprintf( __( 'Viewing members %d to %d (of %d members)', 'buddypress' ), $from_num, $to_num, $members_template->total_member_count ) ); 
     1504        $to_num = ( $from_num + ( $members_template->pag_num - 1 ) > $members_template->total_member_count ) ? $members_template->total_member_count : $from_num + ( $members_template->pag_num - 1 );
     1505
     1506        return apply_filters( 'bp_get_group_member_pagination_count', sprintf( __( 'Viewing members %d to %d (of %d members)', 'buddypress' ), $from_num, $to_num, $members_template->total_member_count ) );
    15071507    }
    15081508
     
    15131513    function bp_get_group_member_admin_pagination() {
    15141514        global $members_template;
    1515        
     1515
    15161516        return $members_template->pag_links;
    15171517    }
     
    15241524function bp_group_creation_tabs() {
    15251525    global $bp;
    1526    
     1526
    15271527    if ( !is_array( $bp->groups->group_creation_steps ) )
    15281528        return false;
    1529    
     1529
    15301530    if ( !$bp->groups->current_create_step )
    15311531        $bp->groups->current_create_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
     
    15341534    foreach ( $bp->groups->group_creation_steps as $slug => $step ) {
    15351535        $is_enabled = bp_are_previous_group_creation_steps_complete( $slug ); ?>
    1536        
     1536
    15371537        <li<?php if ( $bp->groups->current_create_step == $slug ) : ?> class="current"<?php endif; ?>><?php if ( $is_enabled ) : ?><a href="<?php echo $bp->loggedin_user->domain . $bp->groups->slug ?>/create/step/<?php echo $slug ?>"><?php endif; ?><?php echo $counter ?>. <?php echo $step['name'] ?><?php if ( $is_enabled ) : ?></a><?php endif; ?></li><?php
    15381538        $counter++;
    15391539    }
    1540    
     1540
    15411541    unset( $is_enabled );
    1542    
     1542
    15431543    do_action( 'groups_creation_tabs' );
    15441544}
     
    15461546function bp_group_creation_stage_title() {
    15471547    global $bp;
    1548    
     1548
    15491549    echo apply_filters( 'bp_group_creation_stage_title', '<span>&mdash; ' . $bp->groups->group_creation_steps[$bp->groups->current_create_step]['name'] . '</span>' );
    15501550}
     
    15551555    function bp_get_group_creation_form_action() {
    15561556        global $bp;
    1557        
     1557
    15581558        if ( empty( $bp->action_variables[1] ) )
    15591559            $bp->action_variables[1] = array_shift( array_keys( $bp->groups->group_creation_steps ) );
    1560        
     1560
    15611561        return apply_filters( 'bp_get_group_creation_form_action', $bp->loggedin_user->domain . $bp->groups->slug . '/create/step/' . $bp->action_variables[1] );
    15621562    }
     
    15641564function bp_is_group_creation_step( $step_slug ) {
    15651565    global $bp;
    1566    
     1566
    15671567    /* Make sure we are in the groups component */
    15681568    if ( $bp->current_component != BP_GROUPS_SLUG || 'create' != $bp->current_action )
    15691569        return false;
    1570    
     1570
    15711571    /* If this the first step, we can just accept and return true */
    15721572    if ( !$bp->action_variables[1] && array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
    15731573        return true;
    1574    
     1574
    15751575    /* Before allowing a user to see a group creation step we must make sure previous steps are completed */
    15761576    if ( !bp_is_first_group_creation_step() ) {
     
    15781578            return false;
    15791579    }
    1580    
     1580
    15811581    /* Check the current step against the step parameter */
    15821582    if ( $bp->action_variables[1] == $step_slug )
    15831583        return true;
    1584    
     1584
    15851585    return false;
    15861586}
     
    15881588function bp_is_group_creation_step_complete( $step_slugs ) {
    15891589    global $bp;
    1590    
     1590
    15911591    if ( !$bp->groups->completed_create_steps )
    15921592        return false;
     
    15941594    if ( is_array( $step_slugs ) ) {
    15951595        $found = true;
    1596        
     1596
    15971597        foreach ( $step_slugs as $step_slug ) {
    15981598            if ( !in_array( $step_slug, $bp->groups->completed_create_steps ) )
    15991599                $found = false;
    16001600        }
    1601        
     1601
    16021602        return $found;
    16031603    } else {
    1604         return in_array( $step_slugs, $bp->groups->completed_create_steps );   
     1604        return in_array( $step_slugs, $bp->groups->completed_create_steps );
    16051605    }
    16061606
     
    16101610function bp_are_previous_group_creation_steps_complete( $step_slug ) {
    16111611    global $bp;
    1612    
     1612
    16131613    /* If this is the first group creation step, return true */
    16141614    if ( array_shift( array_keys( $bp->groups->group_creation_steps ) ) == $step_slug )
    16151615        return true;
    1616    
     1616
    16171617    reset( $bp->groups->group_creation_steps );
    16181618    unset( $previous_steps );
    1619        
     1619
    16201620    /* Get previous steps */
    16211621    foreach ( $bp->groups->group_creation_steps as $slug => $name ) {
    16221622        if ( $slug == $step_slug )
    16231623            break;
    1624    
     1624
    16251625        $previous_steps[] = $slug;
    16261626    }
    1627    
     1627
    16281628    return bp_is_group_creation_step_complete( $previous_steps );
    16291629}
     
    16361636        return apply_filters( 'bp_get_new_group_id', $bp->groups->new_group_id );
    16371637    }
    1638    
     1638
    16391639function bp_new_group_name() {
    16401640    echo bp_get_new_group_name();
     
    16901690    function bp_get_new_group_avatar( $args = '' ) {
    16911691        global $bp;
    1692            
     1692
    16931693        $defaults = array(
    16941694            'type' => 'full',
     
    16971697            'class' => 'avatar',
    16981698            'id' => 'avatar-crop-preview',
    1699             'alt' => __( 'Group avatar', 'buddypress' ) 
     1699            'alt' => __( 'Group avatar', 'buddypress' )
    17001700        );
    17011701
    17021702        $r = wp_parse_args( $args, $defaults );
    17031703        extract( $r, EXTR_SKIP );
    1704    
     1704
    17051705        return apply_filters( 'bp_get_new_group_avatar', bp_core_fetch_avatar( array( 'item_id' => $bp->groups->current_group->id, 'object' => 'group', 'type' => $type, 'avatar_dir' => 'group-avatars', 'alt' => $alt, 'width' => $width, 'height' => $height, 'class' => $class ) ) );
    17061706    }
     
    17111711    function bp_get_group_creation_previous_link() {
    17121712        global $bp;
    1713        
     1713
    17141714        foreach ( $bp->groups->group_creation_steps as $slug => $name ) {
    17151715            if ( $slug == $bp->action_variables[1] )
    17161716                break;
    1717    
     1717
    17181718            $previous_steps[] = $slug;
    17191719        }
     
    17241724function bp_is_last_group_creation_step() {
    17251725    global $bp;
    1726    
     1726
    17271727    $last_step = array_pop( array_keys( $bp->groups->group_creation_steps ) );
    17281728
    17291729    if ( $last_step == $bp->groups->current_create_step )
    17301730        return true;
    1731    
     1731
    17321732    return false;
    17331733}
     
    17351735function bp_is_first_group_creation_step() {
    17361736    global $bp;
    1737    
     1737
    17381738    $first_step = array_shift( array_keys( $bp->groups->group_creation_steps ) );
    17391739
    17401740    if ( $first_step == $bp->groups->current_create_step )
    17411741        return true;
    1742    
     1742
    17431743    return false;
    17441744}
     
    17521752        if ( !function_exists('friends_install') )
    17531753            return false;
    1754        
     1754
    17551755        $defaults = array(
    17561756            'group_id' => false,
     
    17601760        $r = wp_parse_args( $args, $defaults );
    17611761        extract( $r, EXTR_SKIP );
    1762    
     1762
    17631763        if ( !$group_id )
    17641764            $group_id = ( $bp->groups->new_group_id ) ? $bp->groups->new_group_id : $bp->groups->current_group->id;
    1765            
     1765
    17661766        $friends = friends_get_friends_invite_list( $bp->loggedin_user->id, $group_id );
    1767            
     1767
    17681768        if ( $friends ) {
    17691769            $invites = groups_get_invites_for_group( $bp->loggedin_user->id, $group_id );
     
    17751775                    } else {
    17761776                        $checked = '';
    1777                     } 
     1777                    }
    17781778                }
    1779                
     1779
    17801780                $items[] = '<' . $separator . '><input' . $checked . ' type="checkbox" name="friends[]" id="f-' . $friends[$i]['id'] . '" value="' . attribute_escape( $friends[$i]['id'] ) . '" /> ' . $friends[$i]['full_name'] . '</' . $separator . '>';
    17811781            }
    17821782        }
    1783        
     1783
    17841784        return implode( "\n", (array)$items );
    17851785    }
     
    17941794    var $groups;
    17951795    var $group;
    1796    
     1796
    17971797    var $in_the_loop;
    1798    
     1798
    17991799    var $pag_page;
    18001800    var $pag_num;
    18011801    var $pag_links;
    18021802    var $total_group_count;
    1803    
     1803
    18041804    function bp_groups_site_groups_template( $type, $per_page, $max ) {
    18051805        global $bp;
    1806        
     1806
    18071807        /* TODO: Move $_REQUEST vars out of here */
    1808        
     1808
    18091809        $this->pag_page = isset( $_REQUEST['gpage'] ) ? intval( $_REQUEST['gpage'] ) : 1;
    18101810        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
     
    18141814        } else if ( isset( $_REQUEST['letter'] ) && '' != $_REQUEST['letter'] ) {
    18151815            $this->groups = BP_Groups_Group::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page );
    1816        
     1816
    18171817        } else {
    18181818            switch ( $type ) {
    18191819                case 'active': default:
    18201820                    $this->groups = groups_get_active( $this->pag_num, $this->pag_page );
    1821                     break; 
     1821                    break;
    18221822
    18231823                case 'alphabetical': default:
    18241824                    $this->groups = groups_get_alphabetically( $this->pag_num, $this->pag_page );
    1825                     break; 
    1826                
    1827                 case 'random':     
     1825                    break;
     1826
     1827                case 'random':
    18281828                    $this->groups = groups_get_random_groups( $this->pag_num, $this->pag_page );
    18291829                    break;
    1830                
     1830
    18311831                case 'newest':
    18321832                    $this->groups = groups_get_newest( $this->pag_num, $this->pag_page );
     
    18351835                case 'popular':
    18361836                    $this->groups = groups_get_popular( $this->pag_num, $this->pag_page );
    1837                     break; 
     1837                    break;
    18381838
    18391839                case 'most-forum-topics':
    18401840                    $this->groups = groups_get_by_most_forum_topics( $this->pag_num, $this->pag_page );
    18411841                    break;
    1842                
     1842
    18431843                case 'most-forum-posts':
    18441844                    $this->groups = groups_get_by_most_forum_posts( $this->pag_num, $this->pag_page );
     
    18461846            }
    18471847        }
    1848        
     1848
    18491849        if ( !$max || $max >= (int)$this->groups['total'] )
    18501850            $this->total_group_count = (int)$this->groups['total'];
     
    18531853
    18541854        $this->groups = $this->groups['groups'];
    1855        
     1855
    18561856        if ( $max ) {
    18571857            if ( $max >= count($this->groups) )
     
    18621862            $this->group_count = count($this->groups);
    18631863        }
    1864        
     1864
    18651865        if ( (int) $this->total_group_count && (int) $this->pag_num ) {
    18661866            $this->pag_links = paginate_links( array(
     
    18721872                'next_text' => '&raquo;',
    18731873                'mid_size' => 1
    1874             ));     
    1875     }
    1876     }
    1877    
     1874            ));
     1875    }
     1876    }
     1877
    18781878    function has_groups() {
    18791879        if ( $this->group_count )
    18801880            return true;
    1881        
     1881
    18821882        return false;
    18831883    }
    1884    
     1884
    18851885    function next_group() {
    18861886        $this->current_group++;
    18871887        $this->group = $this->groups[$this->current_group];
    1888        
     1888
    18891889        return $this->group;
    18901890    }
    1891    
     1891
    18921892    function rewind_groups() {
    18931893        $this->current_group = -1;
     
    18961896        }
    18971897    }
    1898    
    1899     function groups() { 
     1898
     1899    function groups() {
    19001900        if ( $this->current_group + 1 < $this->group_count ) {
    19011901            return true;
     
    19091909        return false;
    19101910    }
    1911    
     1911
    19121912    function the_group() {
    19131913        global $group;
     
    19151915        $this->in_the_loop = true;
    19161916        $this->group = $this->next_group();
    1917        
     1917
    19181918        if ( !$group = wp_cache_get( 'groups_group_nouserdata_' . $this->group->group_id, 'bp' ) ) {
    19191919            $group = new BP_Groups_Group( $this->group->group_id, false, false );
    19201920            wp_cache_set( 'groups_group_nouserdata_' . $this->group->group_id, $group, 'bp' );
    19211921        }
    1922        
     1922
    19231923        $this->group = $group;
    1924        
     1924
    19251925        if ( 0 == $this->current_group ) // loop has just started
    19261926            do_action('loop_start');
     
    19301930function bp_rewind_site_groups() {
    19311931    global $site_groups_template;
    1932    
    1933     $site_groups_template->rewind_groups(); 
     1932
     1933    $site_groups_template->rewind_groups();
    19341934}
    19351935
     
    19451945    $r = wp_parse_args( $args, $defaults );
    19461946    extract( $r, EXTR_SKIP );
    1947    
     1947
    19481948    // type: active ( default ) | random | newest | popular
    1949    
     1949
    19501950    if ( $max ) {
    19511951        if ( $per_page > $max )
    19521952            $per_page = $max;
    19531953    }
    1954        
     1954
    19551955    $site_groups_template = new BP_Groups_Site_Groups_Template( $type, $per_page, $max );
    19561956    return apply_filters( 'bp_has_site_groups', $site_groups_template->has_groups(), &$site_groups_template );
     
    19591959function bp_site_groups() {
    19601960    global $site_groups_template;
    1961    
     1961
    19621962    return $site_groups_template->groups();
    19631963}
     
    19651965function bp_the_site_group() {
    19661966    global $site_groups_template;
    1967    
     1967
    19681968    return $site_groups_template->the_group();
    19691969}
     
    19711971function bp_site_groups_pagination_count() {
    19721972    global $bp, $site_groups_template;
    1973    
     1973
    19741974    $from_num = intval( ( $site_groups_template->pag_page - 1 ) * $site_groups_template->pag_num ) + 1;
    19751975    $to_num = ( $from_num + ( $site_groups_template->pag_num - 1 ) > $site_groups_template->total_group_count ) ? $site_groups_template->total_group_count : $from_num + ( $site_groups_template->pag_num - 1) ;
    19761976
    19771977    echo sprintf( __( 'Viewing group %d to %d (of %d groups)', 'buddypress' ), $from_num, $to_num, $site_groups_template->total_group_count ); ?> &nbsp;
    1978     <span class="ajax-loader"></span><?php 
     1978    <span class="ajax-loader"></span><?php
    19791979}
    19801980
     
    19841984    function bp_get_site_groups_pagination_links() {
    19851985        global $site_groups_template;
    1986        
     1986
    19871987        return apply_filters( 'bp_get_site_groups_pagination_links', $site_groups_template->pag_links );
    19881988    }
     
    19931993    function bp_get_the_site_group_id() {
    19941994        global $site_groups_template;
    1995        
     1995
    19961996        return apply_filters( 'bp_get_the_site_group_id', $site_groups_template->group->id );
    19971997    }
     
    20112011    function bp_get_the_site_group_avatar_thumb() {
    20122012        global $site_groups_template;
    2013        
     2013
    20142014        return apply_filters( 'bp_get_the_site_group_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $site_groups_template->group->id, 'object' => 'group', 'type' => 'thumb', 'avatar_dir' => 'group-avatars', 'alt' => __( 'Group Avatar', 'buddypress' ) ) ) );
    20152015    }
     
    20292029    function bp_get_the_site_group_link() {
    20302030        global $site_groups_template;
    2031        
     2031
    20322032        return apply_filters( 'bp_get_the_site_group_link', bp_get_group_permalink( $site_groups_template->group ) );
    20332033    }
     
    20412041        return apply_filters( 'bp_get_the_site_group_name', bp_get_group_name( $site_groups_template->group ) );
    20422042    }
    2043    
     2043
    20442044
    20452045function bp_the_site_group_last_active() {
     
    20542054function bp_the_site_group_join_button() {
    20552055    global $site_groups_template;
    2056    
     2056
    20572057    echo bp_group_join_button( $site_groups_template->group );
    20582058}
     
    20642064        global $site_groups_template;
    20652065
    2066         return apply_filters( 'bp_get_the_site_group_description', bp_get_group_description( $site_groups_template->group ) ); 
     2066        return apply_filters( 'bp_get_the_site_group_description', bp_get_group_description( $site_groups_template->group ) );
    20672067    }
    20682068
     
    20732073        global $site_groups_template;
    20742074
    2075         return apply_filters( 'bp_get_the_site_group_description_excerpt', bp_create_excerpt( bp_get_group_description( $site_groups_template->group, false ), 25 ) ); 
     2075        return apply_filters( 'bp_get_the_site_group_description_excerpt', bp_create_excerpt( bp_get_group_description( $site_groups_template->group, false ), 25 ) );
    20762076    }
    20772077
    20782078function bp_the_site_group_date_created() {
    2079     echo bp_get_the_site_group_date_created(); 
     2079    echo bp_get_the_site_group_date_created();
    20802080}
    20812081    function bp_get_the_site_group_date_created() {
    20822082        global $site_groups_template;
    20832083
    2084         return apply_filters( 'bp_get_the_site_group_date_created', bp_core_time_since( $site_groups_template->group->date_created ) ); 
     2084        return apply_filters( 'bp_get_the_site_group_date_created', bp_core_time_since( $site_groups_template->group->date_created ) );
    20852085    }
    20862086
     
    20942094            return apply_filters( 'bp_get_the_site_group_member_count', sprintf( __( '%d member', 'buddypress' ), (int) $site_groups_template->group->total_member_count ) );
    20952095        else
    2096             return apply_filters( 'bp_get_the_site_group_member_count', sprintf( __( '%d members', 'buddypress' ), (int) $site_groups_template->group->total_member_count ) );     
     2096            return apply_filters( 'bp_get_the_site_group_member_count', sprintf( __( '%d members', 'buddypress' ), (int) $site_groups_template->group->total_member_count ) );
    20972097    }
    20982098
     
    21242124        if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
    21252125            return false;
    2126            
     2126
    21272127        if ( !$site_groups_template->group->forum_counts )
    21282128            $site_groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     
    21322132                $total_topics = sprintf( __( '%d topic', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->topics );
    21332133            else
    2134                 $total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->topics );   
     2134                $total_topics = sprintf( __( '%d topics', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->topics );
    21352135        } else {
    21362136            $total_topics = (int) $site_groups_template->group->forum_counts[0]->topics;
    21372137        }
    2138        
     2138
    21392139        return apply_filters( 'bp_get_the_site_group_forum_topic_count', $total_topics, (bool)$showtext );
    21402140    }
     
    21452145    function bp_get_the_site_group_forum_post_count( $args = '' ) {
    21462146        global $site_groups_template;
    2147        
     2147
    21482148        $defaults = array(
    21492149            'showtext' => false
     
    21522152        $r = wp_parse_args( $args, $defaults );
    21532153        extract( $r, EXTR_SKIP );
    2154        
     2154
    21552155        if ( !$forum_id = groups_get_groupmeta( $site_groups_template->group->id, 'forum_id' ) )
    21562156            return false;
     
    21582158        if ( !function_exists( 'bp_forums_get_forum_topicpost_count' ) )
    21592159            return false;
    2160            
     2160
    21612161        if ( !$site_groups_template->group->forum_counts )
    21622162            $site_groups_template->group->forum_counts = bp_forums_get_forum_topicpost_count( (int)$forum_id );
     
    21662166                $total_posts = sprintf( __( '%d post', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->posts );
    21672167            else
    2168                 $total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->posts );   
     2168                $total_posts = sprintf( __( '%d posts', 'buddypress' ), (int) $site_groups_template->group->forum_counts[0]->posts );
    21692169        } else {
    21702170            $total_posts = (int) $site_groups_template->group->forum_counts[0]->posts;
    21712171        }
    2172        
     2172
    21732173        return apply_filters( 'bp_get_the_site_group_forum_post_count', $total_posts, (bool)$showtext );
    21742174    }
     
    21782178        echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['s'] ) . '" name="search_terms" />';
    21792179    }
    2180    
     2180
    21812181    if ( isset( $_REQUEST['letter'] ) ) {
    21822182        echo '<input type="hidden" id="selected_letter" value="' . attribute_escape( $_REQUEST['letter'] ) . '" name="selected_letter" />';
    21832183    }
    2184    
     2184
    21852185    if ( isset( $_REQUEST['groups_search'] ) ) {
    21862186        echo '<input type="hidden" id="search_terms" value="' . attribute_escape( $_REQUEST['groups_search'] ) . '" name="search_terms" />';
     
    22062206    var $requests;
    22072207    var $request;
    2208    
     2208
    22092209    var $in_the_loop;
    2210    
     2210
    22112211    var $pag_page;
    22122212    var $pag_num;
    22132213    var $pag_links;
    22142214    var $total_request_count;
    2215    
     2215
    22162216    function bp_groups_membership_requests_template( $group_id, $per_page, $max ) {
    22172217        global $bp;
    2218        
     2218
    22192219        $this->pag_page = isset( $_REQUEST['mrpage'] ) ? intval( $_REQUEST['mrpage'] ) : 1;
    22202220        $this->pag_num = isset( $_REQUEST['num'] ) ? intval( $_REQUEST['num'] ) : $per_page;
    2221        
    2222         $this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );       
     2221
     2222        $this->requests = BP_Groups_Group::get_membership_requests( $group_id, $this->pag_num, $this->pag_page );
    22232223
    22242224        if ( !$max || $max >= (int)$this->requests['total'] )
     
    22282228
    22292229        $this->requests = $this->requests['requests'];
    2230        
     2230
    22312231        if ( $max ) {
    22322232            if ( $max >= count($this->requests) )
     
    22482248        ));
    22492249    }
    2250    
     2250
    22512251    function has_requests() {
    22522252        if ( $this->request_count )
    22532253            return true;
    2254        
     2254
    22552255        return false;
    22562256    }
    2257    
     2257
    22582258    function next_request() {
    22592259        $this->current_request++;
    22602260        $this->request = $this->requests[$this->current_request];
    2261        
     2261
    22622262        return $this->request;
    22632263    }
    2264    
     2264
    22652265    function rewind_requests() {
    22662266        $this->current_request = -1;
     
    22692269        }
    22702270    }
    2271    
    2272     function requests() { 
     2271
     2272    function requests() {
    22732273        if ( $this->current_request + 1 < $this->request_count ) {
    22742274            return true;
     
    22822282        return false;
    22832283    }
    2284    
     2284
    22852285    function the_request() {
    22862286        global $request;
     
    23122312function bp_group_membership_requests() {
    23132313    global $requests_template;
    2314    
     2314
    23152315    return $requests_template->requests();
    23162316}
     
    23182318function bp_group_the_membership_request() {
    23192319    global $requests_template;
    2320    
     2320
    23212321    return $requests_template->the_request();
    23222322}
     
    23242324function bp_group_request_user_avatar_thumb() {
    23252325    global $requests_template;
    2326    
     2326
    23272327    echo apply_filters( 'bp_group_request_user_avatar_thumb', bp_core_fetch_avatar( array( 'item_id' => $requests_template->request->user_id, 'type' => 'thumb' ) ) );
    23282328}
    23292329
    23302330function bp_group_request_reject_link() {
    2331     global $requests_template, $groups_template;   
     2331    global $requests_template, $groups_template;
    23322332
    23332333    echo apply_filters( 'bp_group_request_reject_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . '/admin/membership-requests/reject/' . $requests_template->request->id, 'groups_reject_membership_request' ) );
     
    23352335
    23362336function bp_group_request_accept_link() {
    2337     global $requests_template, $groups_template;   
     2337    global $requests_template, $groups_template;
    23382338
    23392339    echo apply_filters( 'bp_group_request_accept_link', wp_nonce_url( bp_get_group_permalink( $groups_template->group ) . '/admin/membership-requests/accept/' . $requests_template->request->id, 'groups_accept_membership_request' ) );
     
    23412341
    23422342function bp_group_request_time_since_requested() {
    2343     global $requests_template; 
     2343    global $requests_template;
    23442344
    23452345    echo apply_filters( 'bp_group_request_time_since_requested', sprintf( __( 'requested %s ago', 'buddypress' ), bp_core_time_since( strtotime( $requests_template->request->date_modified ) ) ) );
     
    23482348function bp_group_request_comment() {
    23492349    global $requests_template;
    2350    
     2350
    23512351    echo apply_filters( 'bp_group_request_comment', strip_tags( stripslashes( $requests_template->request->comments ) ) );
    23522352}
     
    23542354function bp_group_request_user_link() {
    23552355    global $requests_template;
    2356    
     2356
    23572357    echo apply_filters( 'bp_group_request_user_link', bp_core_get_userlink( $requests_template->request->user_id ) );
    23582358}
     
    23682368    var $invites;
    23692369    var $invite;
    2370    
     2370
    23712371    var $in_the_loop;
    2372    
     2372
    23732373    var $pag_page;
    23742374    var $pag_num;
    23752375    var $pag_links;
    23762376    var $total_invite_count;
    2377    
     2377
    23782378    function bp_groups_invite_template( $user_id, $group_id ) {
    23792379        global $bp;
    23802380
    23812381        $this->invites = groups_get_invites_for_group( $user_id, $group_id );
    2382         $this->invite_count = count( $this->invites ); 
    2383     }
    2384    
     2382        $this->invite_count = count( $this->invites );
     2383    }
     2384
    23852385    function has_invites() {
    23862386        if ( $this->invite_count )
    23872387            return true;
    2388        
     2388
    23892389        return false;
    23902390    }
    2391    
     2391
    23922392    function next_invite() {
    23932393        $this->current_invite++;
    23942394        $this->invite = $this->invites[$this->current_invite];
    2395        
     2395
    23962396        return $this->invite;
    23972397    }
    2398    
     2398
    23992399    function rewind_invites() {
    24002400        $this->current_invite = -1;
     
    24032403        }
    24042404    }
    2405    
    2406     function invites() { 
     2405
     2406    function invites() {
    24072407        if ( $this->current_invite + 1 < $this->invite_count ) {
    24082408            return true;
     
    24162416        return false;
    24172417    }
    2418    
     2418
    24192419    function the_invite() {
    24202420        global $invite;
     
    24222422        $this->in_the_loop = true;
    24232423        $user_id = $this->next_invite();
    2424        
     2424
    24252425        $this->invite = new stdClass;
    24262426        $this->invite->user = new BP_Core_User( $user_id );
    24272427        $this->invite->group_id = $group_id; // Globaled in bp_group_has_invites()
    2428        
     2428
    24292429        if ( 0 == $this->current_invite ) // loop has just started
    24302430            do_action('loop_start');
     
    24342434function bp_group_has_invites( $args = '' ) {
    24352435    global $bp, $invites_template, $group_id;
    2436    
     2436
    24372437    $defaults = array(
    24382438        'group_id' => false,
     
    24422442    $r = wp_parse_args( $args, $defaults );
    24432443    extract( $r, EXTR_SKIP );
    2444    
     2444
    24452445    if ( !$group_id ) {
    24462446        /* Backwards compatibility */
     
    24482448        if ( $bp->groups->new_group_id ) $group_id = $bp->groups->new_group_id;
    24492449    }
    2450    
     2450
    24512451    if ( !$group_id )
    24522452        return false;
     
    24582458function bp_group_invites() {
    24592459    global $invites_template;
    2460    
     2460
    24612461    return $invites_template->invites();
    24622462}
     
    24642464function bp_group_the_invite() {
    24652465    global $invites_template;
    2466    
     2466
    24672467    return $invites_template->the_invite();
    24682468}
     
    25092509    function bp_get_group_invite_user_remove_invite_url() {
    25102510        global $invites_template;
    2511        
     2511
    25122512        return wp_nonce_url( site_url( BP_GROUPS_SLUG . '/' . $invites_template->invite->group_id . '/invites/remove/' . $invites_template->invite->user->id ), 'groups_invite_uninvite_user' );
    25132513    }
Note: See TracChangeset for help on using the changeset viewer.