BuddyDev

Search

Friends Suggestion – matching multi-select fields not working

  • Participant
    Level: Initiated
    Posts: 6
    Arthur Schladt on #52964

    Hi Brajesh,
    I cant believe, that so easy functional not be implemented!
    As I understand, it just need to correct the sql-query for comparing data from two fields.
    Maybe it possible to write some pattern for LIKE operator, or use some other operator

  • Keymaster
    (BuddyDev Team)
    Posts: 24712
    Brajesh Singh on #52969

    Hi Arthur,
    The problem is how the value is stored and used in BuddyPress and BuddyBoss.

    If you edit a profile field with options, their ids(they are stored as child field ) change even if there is one value change.

    That leads to mismatched expectations.
    It is not a technical issue to match multiple fields with IN query, It is to have a predictable behaviour. If you can share your field ids(with multi select), we may be able to supply some code.

    Thank you
    Brajesh

  • Participant
    Level: Initiated
    Posts: 6
    Arthur Schladt on #53000

    OMG Guys, what a “Support”!
    I had to find a solution myself 🙁
    and it was only 2 additional row of code:

    foreach ( $value as $val ) {
      $xp_query[] = array(
      'field'   => $rule['match_field_id'],
      'value'   => $val,
      'compare' => $compare,
    );
    }

    in bp_friends_suggestions_pro_get_xprofile_query function
    😐

  • Keymaster
    (BuddyDev Team)
    Posts: 24712
    Brajesh Singh on #53001

    Hi Arthur,
    I am glad you have resolved it. Also, you are welcome to have your opinion!

    I offered you to help with custom code given your field ids. I will quote the reply

    It is not a technical issue to match multiple fields with IN query, It is to have a predictable behaviour. If you can share your field ids(with multi select), we may be able to supply some code.

    It was never a technical issue to have it. The problem is to have predictable behaviour for all field/field types as we did not limit IN/NOT IN to certain field types.

    The operator was dropped in past(around 2021) to achieve that goal.

    Regards
    Brajesh

You must be logged in to reply to this topic.

This topic is: not resolved