• Resolved Nifty

    (@niftythree)


    Hello,

    On the home page of our site, we have static links that search particular profile fields of all BP users. E.g. one looks for dog lovers, by searching for users who have selected that they have a pet dog. The URL we use is: https://www.domain.com/members/?field_80=Dog&bps_form=205

    This search no longer works for profile fields that use a checkbox; instead of only showing users with a pet dog, all users will be shown. When changed to another type (e.g. drop down select box) the search works perfectly. We suspect that this is occurring since a recent BP update. Can you confirm this is the case, and if so, if it will be fixed in an update soon?

    Thank you.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author Andrea Tarantini

    (@dontdream)

    Hello Nifty,

    Your search URL must match the search mode selected for field 80 in form 205.

    For example, if you selected the “match any” search mode, your search URL will be:

    https://www.domain.com/members/?field_80_match_any=Dog&bps_form=205

    This is to prevent your visitors from running arbitrary searches on your user database, as explained in:

    https://dontdream.it/potential-privacy-problem-fixed-in-5-0-2/

    The post above also explains a convenient way to get the correct search URL:

    The query string is the same string that BP Profile Search generates when you choose Form Method: GET in the Form Settings box.

    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    Thanks for the URL and the information; the search mode works with the URL you’ve provided.

    I just don’t understand why the URL I was previously using wouldn’t work when the profile field type was a check box, but it would work when I changed the type to a drop down box?

    The new URL you provided also adds the name of field 80 below the user card after the search is completed, when the other searches I have (with the old URL, but all drop down box types) don’t do this. I’d prefer the field name to not be there, if possible?

    Thank you.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Nifty,

    I just don’t understand why the URL I was previously using wouldn’t work when the profile field type was a check box, but it would work when I changed the type to a drop down box?

    For a drop-down box, the allowed search modes are ‘is’ and ‘is one of’. Only when the search mode is ‘is’, the search mode is omitted in the search URL.

    The new URL you provided also adds the name of field 80 below the user card after the search is completed, when the other searches I have (with the old URL, but all drop down box types) don’t do this. I’d prefer the field name to not be there, if possible?

    The field value is added when it’s not otherwise clear what the value is, see:

    https://dontdream.it/bp-profile-search-5-0-2/

    The post above also explains how to remove that feature, adding this code to bp-custom.php:

    add_filter ('bps_details', 'remove_details');
    function remove_details ($details)
    {
    	$details = array ();
    	return $details;
    }
    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    Thanks for the clarification and extra information. ??

    We’ve also noticed that without the code you supplied, a users exact birthday will be displayed on user cards when an age range search is done and then sorted by “Aged”, instead of only displaying their age as it does before the sorting is applied.

    We know we can disable this sorting feature through the code on the dontdream.it link you provided, and remove the field value as you outlined, but it seems like a privacy issue for full birthdays to be displayed if this code isn’t used?

    Thanks.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Nifty,

    What profile field type is your “birthday” field? Is it a custom type provided by another plugin?

    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    We’re using the “date selector” field type, with the date format being set as “Age” (since the BP 8.0 update); we don’t think there’s anything custom.

    Thanks for your ongoing assistance! ??

    Plugin Author Andrea Tarantini

    (@dontdream)

    Unfortunately I can’t replicate this problem, I always get something like:

    Age: 37 years

    in the user card. Are you aware of anything that could explain the difference?

    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    We’ve done a bit more testing, and we think we have worked out what’s causing this.

    When the persistent search is set to “No” on the profile search form being used, the user’s full birthday will be displayed on their user card when search results are sorted by Age. If persistent search is set to “Yes”, only their age will be displayed.

    Thanks.

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Nifty,

    I’m still unable to reproduce the bug. A few questions:

    – What does the user card show when you don’t run any search?

    – Are you using the [bps_directory] shortcode in your members directory?

    – Do you have any directory customization code in your bp-custom.php?

    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    Thanks for your ongoing help.

    When we don’t run a search, the user cards only show the user’s name and gender; age isn’t shown unless a specific search for this is done. We are using [bps_directory] shortcode in our member directories.

    We’ve been able to replicate the issue on both our main site, and on a clean install that doesn’t have any customisation, so don’t believe there’s any custom code that’s causing this.

    Through further testing on our main site and a clean install, we think the issue is caused by the Grimlock plugin that comes with the Gwangi theme; when Grimlock is turned off, the user card will only show age. The issue can be replicated through the following steps on a Gwangi demo site here: https://dating.gwangi-theme.com/
    1. Complete search on home page for age range only – user cards will show ages.
    2. Sort results by “Age” – user cards will now show exact dates of birth, instead of age.

    Thanks.

    • This reply was modified 3 years, 7 months ago by Nifty.
    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi Nifty,

    Your link to the Gwangi demo site helped a lot!

    Try the following:

    1. On that demo site, search for age 20 to 25;
    2. After you get the results (8 members), sort them by Age;
    3. Note that now the whole directory is displayed.

    That means the search cookie is lost, most likely because Grimlock performs a new page load behind the scenes. The solution, as you noted earlier, is to enable the Persistent Search option, that preserves the search cookie until the end of the browser session, or until the user clears the filters.

    By the way, I noticed that the currently active filters and their Clear button are not displayed by Gwangi, so you won’t be able to clear a persistent search unless you run another search, possibly with all the search fields empty.

    Thread Starter Nifty

    (@niftythree)

    Hi Andrea,

    That’s really helpful information, thank you! ??

    We’ve notified the Gwangi/Grimlock team of the issue; no solutions from them yet, but we can let you know the outcome, if you’re interested.

    Thanks.

    Plugin Author Andrea Tarantini

    (@dontdream)

    You are welcome, and thank you for keeping me informed!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Profile field search with checkboxes not working’ is closed to new replies.