bp_member_type_query( $query )

Member directory tabs content.

Description

Parameters

$query

(Required)

Source

File: bp-core/deprecated/buddyboss/1.2.9.php

function bp_member_type_query( $query ) {
	global $wpdb;

	$cookie_scope = filter_input( INPUT_COOKIE, 'bp-members-scope', FILTER_VALIDATE_INT );
	//$post_scope   = filter_input( INPUT_POST, 'scope', FILTER_VALIDATE_INT );
	$post_scope   = isset( $_POST['scope'] )? intval( $_POST['scope'] ) : null;

	if ( $post_scope ) {
		$type_id = $post_scope;
	} elseif ( $cookie_scope ) {
		$type_id = $cookie_scope;
	}

	if ( isset( $type_id ) ) {

		//Alter SELECT with INNER JOIN
		$query->uid_clauses['select'] .= " INNER JOIN {$wpdb->prefix}term_relationships r ON u.{$query->uid_name} = r.object_id ";

		//Alter WHERE clause
		$query_where_glue            = empty( $query->uid_clauses['where'] ) ? ' WHERE ' : ' AND ';
		$query->uid_clauses['where'] .= $query_where_glue . "r.term_taxonomy_id = {$type_id} ";
	}
}

Changelog

Changelog
Version Description
BuddyBoss 1.0.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.