Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: Display filtered overview of members

@barodscheff

Participant

Ok, I solved it.
For those who are interested in the solution: you have to use the prefix

// Set $wpdb global =  WPrequirement
global $wpdb;

// Get all male members from DB
$male = $wpdb->get_var( "SELECT COUNT(user_id) FROM ar_bp_xprofile_data WHERE value = 'male' AND user_id IN (SELECT user_id FROM ar_bp_xprofile_data WHERE value = 'Soccer')" );
echo 'Male: ' . $male . '<br>';

// Get all female members from DB
$female = $wpdb->get_var( "SELECT COUNT(user_id) FROM ar_bp_xprofile_data WHERE value = 'female' AND user_id IN (SELECT user_id FROM ar_bp_xprofile_data WHERE value = 'Soccer')" );
echo 'Female: ' . $female . '<br>';

Thank you for your help.

Skip to toolbar