-
Author
-
December 16, 2014 at 14:58 #39293webpixelParticipant
Hello again.
I use code below to only show – Opposite sex.
But when i Search for anything in “Memberlist by using the form” it shows both SEX.
How can i make it only show opposite sex even when searching?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( 3, bp_loggedin_user_id() ); if ( $sex == 'SugarDaddy' ) $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 3 AND value = 'SugarBabe'"; else $query = "SELECT user_id FROM {$wpdb->prefix}bp_xprofile_data WHERE field_id = 3 AND value = 'SugarDaddy'"; $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' );
December 16, 2014 at 16:51 #39309LauraModeratorHello, the form is made to search for, this code only hides it from member directory, maybe you could just delete searching for gender, or use any field conditional plugin.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
December 16, 2014 at 18:59 #39331webpixelParticipantBut this happens, if i just search for Age. (the build in “Age to Age” field)
December 16, 2014 at 19:01 #39333LauraModeratorHello, this is something that needs to be changed in with extra programming so i suggest to hire a developer to do this for you.
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
December 23, 2014 at 00:48 #40085AbeKeymasterhi Webpixel, right now we can’t take custom work. For now try a site like Envato Studio or any freenlancer service
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.January 13, 2015 at 19:55 #41937webpixelParticipantOkay thank you.
Can you tell me what variable checks what membership ID the profile have been assigned from Membership pro?
January 15, 2015 at 22:13 #42258AbeKeymasterhere it is:
pmpro_getMembershipLevelForUser($user_id);Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution---
@ SeventhQueen we do our best to have super happy customers. Thanks for being our customer. -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.