Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/13/2009 01:24:21 AM (17 years ago)
Author:
apeatling
Message:

Add first revision of new default BuddyPress parent theme. This theme is designed to be extended from with child themes, not used directly. The original default themes from the old two theme system are deprecated, but will remain compatible with 1.1. Still more work to do there.

File:
1 edited

Legend:

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

    r1636 r1655  
    2929        <?php if ( bp_has_site_groups( 'type=popular&per_page=' . $instance['max_groups'] . '&max=' . $instance['max_groups'] ) ) : ?>
    3030            <div class="item-options" id="groups-list-options">
    31                 <img id="ajax-loader-groups" src="<?php echo $bp->groups->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( 'Loading', 'buddypress' ) ?>" style="display: none;" />
     31                <span class="ajax-loader"></span>
    3232                <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="newest-groups"><?php _e("Newest", 'buddypress') ?></a> |
    3333                <a href="<?php echo site_url() . '/' . $bp->groups->slug ?>" id="recently-active-groups"><?php _e("Active", 'buddypress') ?></a> |
     
    8181    }
    8282}
     83
     84function groups_ajax_widget_groups_list() {
     85    global $bp;
     86       
     87    check_ajax_referer('groups_widget_groups_list');
     88
     89    switch ( $_POST['filter'] ) {
     90        case 'newest-groups':
     91            $type = 'newest';
     92        break;
     93        case 'recently-active-groups':
     94            $type = 'active';
     95        break;
     96        case 'popular-groups':
     97            $type = 'popular';
     98        break;
     99    }
     100
     101    if ( bp_has_site_groups( 'type=' . $type . '&per_page=' . $_POST['max_groups'] . '&max=' . $_POST['max_groups'] ) ) : ?>
     102        <?php echo "0[[SPLIT]]"; ?>
     103               
     104        <ul id="groups-list" class="item-list">
     105            <?php while ( bp_site_groups() ) : bp_the_site_group(); ?>
     106                <li>
     107                    <div class="item-avatar">
     108                        <a href="<?php bp_the_site_group_link() ?>"><?php bp_the_site_group_avatar_thumb() ?></a>
     109                    </div>
     110
     111                    <div class="item">
     112                        <div class="item-title"><a href="<?php bp_the_site_group_link() ?>" title="<?php bp_the_site_group_name() ?>"><?php bp_the_site_group_name() ?></a></div>
     113                        <div class="item-meta">
     114                            <span class="activity">
     115                                <?php
     116                                if ( 'newest-groups' == $_POST['filter'] ) {
     117                                    bp_the_site_group_date_created();
     118                                } else if ( 'recently-active-groups' == $_POST['filter'] ) {
     119                                    bp_the_site_group_last_active();
     120                                } else if ( 'popular-groups' == $_POST['filter'] ) {
     121                                    bp_the_site_group_member_count();
     122                                }
     123                                ?>
     124                            </span>
     125                        </div>
     126                    </div>
     127                </li>
     128
     129            <?php endwhile; ?>
     130        </ul>       
     131        <?php wp_nonce_field( 'groups_widget_groups_list', '_wpnonce-groups' ); ?>
     132        <input type="hidden" name="groups_widget_max" id="groups_widget_max" value="<?php echo attribute_escape( $_POST['max_groups'] ); ?>" />
     133       
     134    <?php else: ?>
     135
     136        <?php echo "-1[[SPLIT]]<li>" . __("No groups matched the current filter.", 'buddypress'); ?>
     137
     138    <?php endif;
     139   
     140}
     141add_action( 'wp_ajax_widget_groups_list', 'groups_ajax_widget_groups_list' );
    83142?>
Note: See TracChangeset for help on using the changeset viewer.