Tagged: Bp profile search issue
For logged in user if member is male then member list of female members should show and vice versa. Now from that list only the BP profile search form should work.
I used the code in function.php for male female filter after registration, which works fine. But when I used this code, the BP profile search plugin is not working well as it shows all members list. How can I solve this issue as this code is also important and BP profile search based on members profile field is also important.
Thank you for posting.
Here is a simple solution that I used for one of the dating based site I worked in past.
1. define two member types ‘male’, ‘female’
2. Assign proper member types to the user on registration. You may use my xprofile member type field plugin
3. Now filter bp_after_has_members_parse_args
a) If user is not logged in, no need to do anything, just return the args
b) If we are here, the user is logged in, Get his/her member type
c) Find out the opposite member type
d) In the $args set ‘member_type’ = $opposite_membe_type
e). In newer version of BuddyPress, you may avoid step c, d and set ‘member_type__not_in’ to current member’s member type
That will work with BP Profile search and filter the lists based on the member type.
Hope that helps.
You must be logged in to reply to this topic.