BP_Members_Admin::remove_signups_from_user_query( WP_User_Query|null $query = null )

Make sure no signups will show in users list.


Description Description

This is needed to handle signups that may have not been activated before the 2.0.0 upgrade.


Parameters Parameters

$query

(Optional) The users query.

Default value: null


Top ↑

Return Return

(WP_User_Query|null) The users query without the signups.


Top ↑

Source Source

File: bp-members/classes/class-bp-members-admin.php

	public function remove_signups_from_user_query( $query = null ) {
		global $wpdb;

		// Bail if this is an ajax request.
		if ( defined( 'DOING_AJAX' ) ) {
			return;
		}

		// Bail if updating BuddyPress.
		if ( bp_is_update() ) {
			return;
		}

		// Bail if there is no current admin screen.
		if ( ! function_exists( 'get_current_screen' ) || ! get_current_screen() ) {
			return;
		}

		// Get current screen.
		$current_screen = get_current_screen();

		// Bail if not on a users page.
		if ( ! isset( $current_screen->id ) || $this->users_page !== $current_screen->id ) {
			return;
		}

		// Bail if already querying by an existing role.
		if ( ! empty( $query->query_vars['role'] ) ) {
			return;
		}

		$query->query_where .= " AND {$wpdb->users}.user_status != 2";
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.