WordPress.org

Ready to get started?Download WordPress

Forums

BP Profile Search
How to search multiple words per field? Will pay $$$ for help :) (4 posts)

  1. SeidonBro
    Member
    Posted 1 year ago #

    Hi,

    Firstly, I want to say what an amazing plugin this is! Thank you so much for developing it!

    I have a problem that I hope you can help with.

    I have a profile field (text box) called 'Interests' where people can add as many words (interests) as they like.

    The issue I'm having is that I can ONLY search one word / Interest at a time - for example, if I search the term 'Art' it will only find people interested in Art.

    The problem for me is that if I search 'Art Surfing' - instead of picking everyone who is interested in Art and everyone who is interested in Surfing, it doesn't pick up anyone at all.

    Is there a way around this?

    So if I type in 'Art Surfing' I find people who have entered the word 'Art' as well as the people who have entered the word 'Surfing'.

    I would very much appreciate some assistance! :)

    I have an ok knowledge of hacking code but despite my efforts, I can't quite get it to work.

    http://wordpress.org/extend/plugins/bp-profile-search/

  2. SeidonBro
    Member
    Posted 1 year ago #

    Important:

    With what I'm building, I'm going to be setting the 'values' MANUALLY - the user will not be able to enter search terms, they will be pre-chosen for them.

    I know the problem is with the way the search specifies the value:

    (Beginning line 107 in bps_functions.php)

    case 'textbox':
    case 'textarea':
    $sql = "SELECT user_id from {$bp->profile->table_name_data}";
    if ($bps_options['searchmode'] == 'Partial Match')
        $sql .= " WHERE field_id = $id AND value LIKE '%%$value%%'";
    else
        $sql .= " WHERE field_id = $id AND value LIKE '$value'";
    break;

    Basically, all I need to do is get the search to recognise multiple, individual 'values' from a single field...

  3. SeidonBro
    Member
    Posted 1 year ago #

    I've tried adding multiple values in manually here:

    (starting line 75 bps_searchform.php)

    case 'textbox':
    echo "
    <label for='$field_input_name'>$field->name</label>
    <input type='text' name='$field_input_name' id='$field_input_name' value='surfing'/>
    ";
    break;

    This works great for searching SINGLE values but all I really need to do is add a second value and make the search look for either:

    Value(1) or Value(2)

  4. TheFreeWorld
    Member
    Posted 1 year ago #

    If you figure this out I would be grateful to hear about it i'd like to put that feature on my page here.

    http://the-free-world.org/members/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.