Skip to:
Content

BuddyPress.org

Opened 20 months ago

Last modified 20 months ago

#8029 new defect (bug)

bp_has_members misbehaving on Nouveau Profile Home page widgets area

Reported by: Venutius Owned by:
Milestone: Awaiting Review Priority: normal
Severity: trivial Version:
Component: Templates Keywords:
Cc:

Description

bp_has_members when executed in the BP Nouveau profile home page widget area using the include= argument fails to return the included user id's and instead returns the displayed user id.

If you add the BudduPress Followers Following widget to the BP Nouveau profile home page widget area it fails to function correctly, returning the displayed user id rather than the id's of the of the following.

To test this you can add the Following widget to the sidebar of the same page and it works correctly, but in the home page widget area it does not.

Change History (3)

#1 @Venutius
20 months ago

I've been looking into this further and it seems that the issue is within bp_parse_args() in bp_has_members. Replacing this is wp_parse_args() fixes the issue.

Last edited 20 months ago by Venutius (previous) (diff)

#2 @Venutius
20 months ago

I've found the reason for this behaviour, it's from bp-templates/bp-nouveau/includes/members/functions.php line 400:

function bp_nouveau_member_members_widget_overrides( $args = array() ) {
	// Do nothing for the friends widget
	if ( ! empty( $args['user_id'] ) && (int) $args['user_id'] === (int) bp_displayed_user_id() ) {
		return $args;
	}

	return array_merge( $args, array(
		'include' => bp_displayed_user_id(),
	) );
}

This filter is being driven by the following in line 283 of bp-core/bp-core functions:

	if ( !empty( $filter_key ) ) {

		$r = apply_filters( 'bp_before_' . $filter_key . '_parse_args', $r );
	}

For the bp_has_members() calls I am making, $filter_key should be empty and it should not be firing. The filter being called is bp_before_has_members_parse_args

So it appears that somehow for Home page widgets a filter key of has_members is being set

#3 @Venutius
20 months ago

  • Severity changed from normal to trivial

So the fix for this is to get the BP Follow widget updated to include a user_id in it's args I reckon.

Note: See TracTickets for help on using tickets.