Forum Replies Created
-
Author
-
DavidParticipant
Add a “mutual match” mode (like Tinder, Bumble) when the users both like each others profile / photo, then the users be will be able to communicate — also add a search mode option that only displays one user at a time, and you can like or not like that user…
DavidParticipantThank you for the quick reply!, I have it working now 🙂
It turns out I had edited the bp-custom.php in the framework/inc/ directory and not the bp-custom.php in /plugins directory. (I went back and checked the original post after I tried the code you posted without success, where you said in the plugins directory…)
The code I posted works correctly.
Thanks again!
DavidParticipant( note [code] and [/code] aren’t in my php file, I put them in the message but apparently those aren’t the correct markup tags for this forum. )
DavidParticipantHi,
Thank you for the reply.
I had replaced the field names as well, but for some reason it doesn’t work.
Here’s the code I have
COPY CODEclass BP_Custom_User_Ids { private $custom_ids = array(); public function __construct() { $this->custom_ids = $this->get_custom_ids(); add_action( 'bp_pre_user_query_construct', array( $this, 'custom_members_query' ), 1, 1 ); add_filter( 'bp_get_total_member_count', array( $this, 'custom_members_count' ), 1, 1 ); } private function get_custom_ids() { global $wpdb; //figure out if the logged-in user is male or female $sex = xprofile_get_field_data( 403, bp_loggedin_user_id() ); if ( $sex == 'Man' ) $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 403 AND value = 'Woman'"; else $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 403 AND value = 'Man'"; $custom_ids = $wpdb->get_col( $query ); return $custom_ids; } function custom_members_query( $query_array ) { $query_array->query_vars['include'] = $this->custom_ids; } function custom_members_count ( $count ) { $new_count = count( $this->custom_ids ); return $new_count; } } function custom_user_ids( ) { new BP_Custom_User_Ids (); } add_action( 'bp_before_directory_members', 'custom_user_ids' );
-
AuthorPosts