__( 'A dynamic list of recently active, popular, and newest Friends of the displayed member. Widget is only shown when viewing a member profile.', 'buddypress' ), 'classname' => 'widget_bp_core_friends_widget buddypress widget', ); parent::__construct( false, $name = _x( '(BuddyPress) Friends', 'widget name', 'buddypress' ), $widget_ops ); } /** * Display the widget. * * @param array $args Widget arguments. * @param array $instance The widget settings, as saved by the user. */ function widget( $args, $instance ) { extract( $args ); if ( ! bp_displayed_user_id() ) { return; } $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script( 'bp_core_widget_friends-js', buddypress()->plugin_url . "bp-friends/js/widget-friends{$min}.js", array( 'jquery' ), bp_get_version() ); $user_id = bp_displayed_user_id(); $link = trailingslashit( bp_displayed_user_domain() . bp_get_friends_slug() ); $instance['title'] = sprintf( __( '%s’s Friends', 'buddypress' ), bp_get_displayed_user_fullname() ); if ( empty( $instance['friend_default'] ) ) { $instance['friend_default'] = 'active'; } $title = apply_filters( 'widget_title', $instance['title'] ); echo $before_widget; $title = $instance['link_title'] ? '' . esc_html( $title ) . '' : esc_html( $title ); echo $before_title . $title . $after_title; $members_args = array( 'user_id' => absint( $user_id ), 'type' => sanitize_text_field( $instance['friend_default'] ), 'max' => absint( $instance['max_friends'] ), 'populate_extras' => 1, ); ?>
bp_displayed_user_id(), 'type' => $type, 'max' => absint( $_POST['max-friends'] ), 'populate_extras' => 1, ); if ( bp_has_members( $members_args ) ) : ?>