do_autoload ) { require dirname( __FILE__ ) . '/classes/class-bp-groups-widget.php'; } /** * Register widgets for groups component. * * @since 1.0.0 */ function groups_register_widgets() { add_action('widgets_init', create_function('', 'return register_widget("BP_Groups_Widget");') ); } add_action( 'bp_register_widgets', 'groups_register_widgets' ); /** * AJAX callback for the Groups List widget. * * @since 1.0.0 */ function groups_ajax_widget_groups_list() { check_ajax_referer( 'groups_widget_groups_list' ); switch ( $_POST['filter'] ) { case 'newest-groups': $type = 'newest'; break; case 'recently-active-groups': $type = 'active'; break; case 'popular-groups': $type = 'popular'; break; } $per_page = isset( $_POST['max_groups'] ) ? intval( $_POST['max_groups'] ) : 5; $groups_args = array( 'user_id' => 0, 'type' => $type, 'per_page' => $per_page, 'max' => $per_page, ); if ( bp_has_groups( $groups_args ) ) : ?>
  • >
  • " . __( "No groups matched the current filter.", 'buddypress' ); ?>