BP_Core_Recently_Active_Widget::widget( array $args, array $instance )

Display the Recently Active widget.


See also



(array) (Required) Widget arguments.


(array) (Required) Widget settings, as saved by the user.


File: bp-members/classes/class-bp-core-recently-active-widget.php

	public function widget( $args, $instance ) {
		global $members_template;

		// Get widget settings.
		$settings = $this->parse_settings( $instance );

		 * Filters the title of the Recently Active widget.
		 * @since BuddyPress 1.8.0
		 * @since BuddyPress 2.3.0 Added 'instance' and 'id_base' to arguments passed to filter.
		 * @param string $title    The widget title.
		 * @param array  $settings 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', $settings['title'], $settings, $this->id_base );
        $refresh_recent_users =  '<a href="" class="bs-widget-reload bs-heartbeat-reload hide"><i class="bb-icon-spin6"></i></a>';

		echo $args['before_widget'];
        echo $args['before_title'] . $title . $refresh_recent_users . $args['after_title'];

		// Setup args for querying members.
		$members_args = array(
			'user_id'         => 0,
			'type'            => 'active',
			'per_page'        => $settings['max_members'],
			'max'             => $settings['max_members'],
			'populate_extras' => true,
			'search_terms'    => false,

		// Back up global.
		$old_members_template = $members_template;

        <div id="boss_recently_active_widget_heartbeat" data-max="<?php echo $settings['max_members']; ?>">
    		<?php if ( bp_has_members( $members_args ) ) : ?>
    			<div class="avatar-block">
    				<?php while ( bp_members() ) : bp_the_member(); ?>
    					<div class="item-avatar">
    						<a href="<?php bp_member_permalink(); ?>" class="bp-tooltip" data-bp-tooltip-pos="up" data-bp-tooltip="<?php bp_member_name(); ?>"><?php bp_member_avatar(); ?></a>
    				<?php endwhile; ?>
                <div class="more-block"><a href="<?php bp_members_directory_permalink(); ?>" class="count-more">More<i class="bb-icon-angle-right"></i></a></div>
    		<?php else: ?>
    			<div class="widget-error">
    				<?php esc_html_e( 'There are no recently active members', 'buddyboss' ); ?>
    		<?php endif; ?>
		<?php echo $args['after_widget'];

		// Restore the global.
		$members_template = $old_members_template;


Version Description
BuddyPress 1.0.3 Introduced.


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.