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

Make sure no signups will show in users list.

Description

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

Parameters

$query

(Optional) The users query.

Default value: null

Return

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

Source

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

1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
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";
}

Changelog

Changelog
Version Description
BuddyPress 2.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.