bp_core_ajax_widget_friends()
Process AJAX pagination or filtering for the Connections widget.
Description
Source
File: bp-friends/bp-friends-widgets.php
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | function bp_core_ajax_widget_friends() { check_ajax_referer( 'bp_core_widget_friends' ); switch ( $_POST [ 'filter' ] ) { case 'newest-friends' : $type = 'newest' ; break ; case 'recently-active-friends' : $type = 'active' ; break ; case 'popular-friends' : $type = 'popular' ; break ; } $members_args = array ( 'user_id' => bp_displayed_user_id(), 'type' => $type , 'max' => absint( $_POST [ 'max-friends' ] ), 'populate_extras' => 1, ); if ( bp_has_members( $members_args ) ) : ?> <?php echo '0[[SPLIT]]' ; // Return valid result. TODO: remove this. ?> <?php while ( bp_members() ) : bp_the_member(); ?> <li class = "vcard" > <div class = "item-avatar" > <a href= "<?php bp_member_permalink(); ?>" ><?php bp_member_avatar(); ?></a> </div> <div class = "item" > <div class = "item-title fn" ><a href= "<?php bp_member_permalink(); ?>" ><?php bp_member_name(); ?></a></div> <?php if ( 'active' == $type ) : ?> <div class = "item-meta" ><span class = "activity" data-livestamp= "<?php bp_core_iso8601_date( bp_get_member_last_active( array( 'relative' => false ) ) ); ?>" ><?php bp_member_last_active(); ?></span></div> <?php elseif ( 'newest' == $type ) : ?> <div class = "item-meta" ><span class = "activity" data-livestamp= "<?php bp_core_iso8601_date( bp_get_member_registered( array( 'relative' => false ) ) ); ?>" ><?php bp_member_registered(); ?></span></div> <?php elseif ( bp_is_active( 'friends' ) ) : ?> <div class = "item-meta" ><span class = "activity" ><?php bp_member_total_friend_count(); ?></span></div> <?php endif ; ?> </div> </li> <?php endwhile ; ?> <?php else : ?> <?php echo "-1[[SPLIT]]<li>" ; ?> <?php _e( 'There were no members found, please try another filter.' , 'buddyboss' ); ?> <?php echo "</li>" ; ?> <?php endif ; } |
Changelog
Version | Description |
---|---|
BuddyPress 1.9.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.