bp_ps_xprofile_gender_users_search( $f )

Fetch the users based on selected value in advance search.

Description

Parameters

$f

(Required)

Return

(array)

Source

File: bp-core/profile-search/bps-xprofile.php

451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
function bp_ps_xprofile_gender_users_search( $f ) {
 
    global $wpdb;
 
    $gender = $f->value;
    if ( isset( $gender ) && ! empty( $gender ) ) {
 
        $exists_gender = $wpdb->get_results( "SELECT COUNT(*) as count, id FROM {$wpdb->prefix}bp_xprofile_fields a WHERE parent_id = 0 AND type = 'gender' ");
 
        $custom_ids = $wpdb->get_col("SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = {$exists_gender[0]->id} AND value = '{$gender}'");
 
        if ( isset( $custom_ids ) && ! empty( $custom_ids ) ) {
            return $custom_ids;
        } else {
            return array();
        }
    } else {
        return array();
    }
}

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.