Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
03/25/2009 04:01:43 PM (15 years ago)
Author:
apeatling
Message:

Removed blogs, groups and members directory from the home theme into the BuddyPress member theme. The directories now have their own templates and theme based CSS and provide much easier editing.

Moved the $bp global setup to a higher priority action - from the 'wp' action to the 'plugins_loaded' action. This stops occurrences where the $bp global was not defined yet.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-core/bp-core-ajax.php

    r1238 r1250  
    6767
    6868function bp_core_ajax_directory_members() {
    69     global $bp;
    70 
    7169    check_ajax_referer('directory_members');
    7270   
    73     $pag_page = isset( $_POST['page'] ) ? intval( $_POST['page'] ) : 1;
    74     $pag_num = isset( $_POST['num'] ) ? intval( $_POST['num'] ) : 10;
    75    
    76     if ( isset( $_POST['letter'] ) && $_POST['letter'] != '' ) {
    77         $users = BP_Core_User::get_users_by_letter( $_POST['letter'], $pag_num, $pag_page );
    78     } else if ( isset ( $_POST['members_search'] ) && $_POST['members_search'] != '' ) {
    79         $users = BP_Core_User::search_users( $_POST['members_search'], $pag_num, $pag_page );
    80     } else {
    81         $users = BP_Core_User::get_active_users( $pag_num, $pag_page );
    82     }
    83 
    84     $pag_links = paginate_links( array(
    85         'base' => add_query_arg( 'page', '%#%' ),
    86         'format' => '',
    87         'total' => ceil( $users['total'] / $pag_num ),
    88         'current' => $pag_page,
    89         'prev_text' => '«',
    90         'next_text' => '»',
    91         'mid_size' => 1
    92     ));
    93    
    94     $from_num = intval( ( $pag_page - 1 ) * $pag_num ) + 1;
    95     $to_num = ( $from_num + ( $pag_num - 1 ) > $users['total'] ) ? $users['total'] : $from_num + ( $pag_num - 1 );
    96    
    97     if ( $users['users'] ) {
    98         echo '0[[SPLIT]]'; // return valid result.
    99        
    100         ?>
    101         <div class="container">
    102             <div id="member-dir-count" class="pag-count">
    103                 <?php echo sprintf( __( 'Viewing member %d to %d (%d total active members)', 'buddypress' ), $from_num, $to_num, $users['total'] ); ?> &nbsp;
    104                 <img id="ajax-loader-members" src="<?php echo $bp->core->image_base ?>/ajax-loader.gif" height="7" alt="<?php _e( "Loading", "buddypress" ) ?>" style="display: none;" />
    105             </div>
    106        
    107             <?php if ( $pag_links ) : ?>
    108                 <div class="pagination-links" id="member-dir-pag">
    109                     <?php echo $pag_links ?>
    110                 </div>
    111             <?php endif; ?>
    112 
    113             <?php   
    114             echo '<ul id="members-list" class="item-list">';
    115             foreach ( (array) $users['users'] as $user ) {
    116             ?>
    117                 <li>
    118                     <div class="item-avatar">
    119                         <?php echo bp_core_get_avatar( $user->user_id, 1 ) ?>
    120                     </div>
    121 
    122                     <div class="item">
    123                         <div class="item-title"><?php echo bp_core_get_userlink( $user->user_id ) ?></div>
    124                         <div class="item-meta"><span class="activity"><?php echo bp_core_get_last_activity( get_usermeta( $user->user_id, 'last_activity' ), __( 'active %s ago', 'buddypress' ) ) ?></span></div>
    125                     </div>
    126                
    127                     <div class="action">
    128                         <?php if ( function_exists('bp_add_friend_button') ) : ?>
    129                             <?php bp_add_friend_button( $user->user_id ) ?>
    130                         <?php endif; ?>
    131                         <div class="meta">
    132                             <?php if ( $user_obj->total_friends ) echo $user_obj->total_friends ?><?php if ( $user_obj->total_blogs ) echo ', ' . $user_obj->total_blogs ?><?php if ( $user_obj->total_groups ) echo ', ' . $user_obj->total_groups ?>
    133                         </div>
    134                     </div>
    135                
    136                     <div class="clear"></div>
    137                 </li>
    138             <?php   
    139             }
    140             echo '</ul>'; ?>
    141         </div>
    142 <?php
    143     } else {
    144         echo "-1[[SPLIT]]<div id='message' class='error'><p>" . __("No members matched the current filter.", 'buddypress') . '</p></div>';
    145     }
    146    
    147     if ( isset( $_POST['letter'] ) ) {
    148         echo '<input type="hidden" id="selected_letter" value="' . $_POST['letter'] . '" name="selected_letter" />';
    149     }
    150    
    151     if ( isset( $_POST['members_search'] ) ) {
    152         echo '<input type="hidden" id="search_terms" value="' . $_POST['members_search'] . '" name="search_terms" />';
    153     }
    154 
     71    load_template( TEMPLATEPATH . '/directories/members/members-loop.php' );
    15572}
    15673add_action( 'wp_ajax_directory_members', 'bp_core_ajax_directory_members' );
Note: See TracChangeset for help on using the changeset viewer.