do_autoload ) { require dirname( __FILE__ ) . '/classes/class-bp-core-friends-widget.php'; } /** * Register the friends widget. * * @since 1.9.0 */ function bp_friends_register_widgets() { if ( ! bp_is_active( 'friends' ) ) { return; } // The Friends widget works only when looking an a displayed user, // and the concept of "displayed user" doesn't exist on non-root blogs, // so we don't register the widget there. if ( ! bp_is_root_blog() ) { return; } add_action( 'widgets_init', create_function( '', 'return register_widget("BP_Core_Friends_Widget");' ) ); } add_action( 'bp_register_widgets', 'bp_friends_register_widgets' ); /** Widget AJAX ***************************************************************/ /** * Process AJAX pagination or filtering for the Friends widget. * * @since 1.9.0 */ 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 ) ) : ?>
  • "; ?> "; ?>