__( 'A dynamic list of recently active, popular, and newest groups', 'buddypress' ), 'classname' => 'widget_bp_groups_widget buddypress widget', ); parent::__construct( false, _x( '(BuddyPress) Groups', 'widget name', 'buddypress' ), $widget_ops ); if ( is_active_widget( false, false, $this->id_base ) && !is_admin() && !is_network_admin() ) { $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; wp_enqueue_script( 'groups_widget_groups_list-js', buddypress()->plugin_url . "bp-groups/js/widget-groups{$min}.js", array( 'jquery' ), bp_get_version() ); } } /** * PHP4 constructor * * For backward compatibility only */ function bp_groups_widget() { $this->_construct(); } function widget( $args, $instance ) { /** * Filters the user ID to use with the widget instance. * * @since 1.5.0 * * @param string $value Empty user ID. */ $user_id = apply_filters( 'bp_group_widget_user_id', '0' ); extract( $args ); if ( empty( $instance['group_default'] ) ) $instance['group_default'] = 'popular'; if ( empty( $instance['title'] ) ) $instance['title'] = __( 'Groups', 'buddypress' ); /** * Filters the title of the Groups widget. * * @since 1.8.0 * @since 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter. * * @param string $title The widget title. * @param array $instance The settings for the particular instance of the widget. * @param string $id_base Root ID for all widgets of this type. */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ); /** * Filters the separator of the group widget links. * * @since 2.4.0 * * @param string $separator Separator string. Default '|'. */ $separator = apply_filters( 'bp_groups_widget_separator', '|' ); echo $before_widget; $title = !empty( $instance['link_title'] ) ? '' . $title . '' : $title; echo $before_title . $title . $after_title; $group_args = array( 'user_id' => $user_id, 'type' => $instance['group_default'], 'per_page' => $instance['max_groups'], 'max' => $instance['max_groups'], ); ?>
0, 'type' => $type, 'per_page' => $per_page, 'max' => $per_page, ); if ( bp_has_groups( $groups_args ) ) : ?>