bp_xprofile_add_xprofile_query_to_user_query( BP_User_Query $q )

Parse ‘xprofile_query’ argument passed to BP_User_Query.

Description

Parameters

$q

(Required) User query object.

Source

File: bp-xprofile/bp-xprofile-filters.php

function bp_xprofile_add_xprofile_query_to_user_query( BP_User_Query $q ) {

	// Bail if no `xprofile_query` clause.
	if ( empty( $q->query_vars['xprofile_query'] ) ) {
		return;
	}

	$xprofile_query = new BP_XProfile_Query( $q->query_vars['xprofile_query'] );
	$sql            = $xprofile_query->get_sql( 'u', $q->uid_name );

	if ( ! empty( $sql['join'] ) ) {
		$q->uid_clauses['select'] .= $sql['join'];
		$q->uid_clauses['where'] .= $sql['where'];
	}
}

Changelog

Changelog
Version Description
BuddyPress 2.2.0 Introduced.

Questions?

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.