BuddyDev

Search

[Resolved] Bp profile search issue

  • Participant
    Level: Initiated
    Posts: 10
    kalpesh on #6332

    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.

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #6333

    Hi Kalpesh,
    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.

  • Participant
    Level: Initiated
    Posts: 10
    kalpesh on #6335

    Thank you for your reply……..

    I did step 1 and 2, defined two member type male and female, and with the help of aforesaid plugin Assigned member type.
    Can you write the code here for step 3, I m using buddypress version 2.6.2

    Thank you so much for help

  • Participant
    Level: Initiated
    Posts: 10
    kalpesh on #6340

    Problem solved………..just followed your steps and did it…
    Thanks Brejesh G

  • Keymaster
    (BuddyDev Team)
    Posts: 24149
    Brajesh Singh on #6345

    Hi Kalpesh,
    Thank you. That’s good to know.

    All the best with your project 🙂

You must be logged in to reply to this topic.

This topic is: resolved