Support » Plugin: BP Profile Search » Please give back ‘Range’

  • Resolved LavishDhand

    (@lavishdhand)



    Hi!

    After a recent update there is no ‘range’ option. I have a form where there is a ‘height’ field and I had range search mode this. How do I now search members for example between the heights of 165 and 180?

    Kindly help

    Thank you!

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

    (@dontdream)

    Hi LavishDhand,

    Which type is your ‘height’ field? If it’s a Number, you should find the ‘range’ option in the Search Mode drop-down, where the ‘Range’ checkbox used to be.

    LavishDhand

    (@lavishdhand)

    Hi @dontdream

    My height field is ‘Drop Down Select Box’. Values are predefined.

    Example

    165.10 cm (5’5″)
    167.64 cm (5’6″)
    170.18 cm (5’7″)
    172.72 cm (5’8″)

    How can I change this to number field? Won’t I lose the old data / settings if I change the field type to number now?

    Thank you for the help

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi @lavishdhand,

    To bring back the range search for your ‘Drop Down Select Box’ field, add this code to your file bp-custom.php:

    add_filter ('bps_xprofile_format', 'change_format', 10, 2);
    function change_format ($default, $field_id)
    {
    	if ($field_id == 1435)  return 'decimal';
    	return $default;
    }

    Replace 1435 with the actual ID of your field.

    You also need to revert to BP Profile Search 4.7.8, the download is at the end of this page:

    https://wordpress.org/plugins/bp-profile-search/advanced/

    This last step is temporary, when I release BP Profile Search 4.8 you can update the plugin as usual.

    Please let me know if these changes work for you!

    LavishDhand

    (@lavishdhand)

    That worked! Thank you. I however have one more field for ‘weight’, this field type is ‘Text Box’. What do I add to the code to fix this one too?

    Thanks for all the help

    Plugin Author Andrea Tarantini

    (@dontdream)

    Great, glad it worked!

    To change the format of two fields:

    add_filter ('bps_xprofile_format', 'change_format', 10, 2);
    function change_format ($default, $field_id)
    {
    	if ($field_id == 1435)  return 'decimal';
    	if ($field_id == 2860)  return 'decimal';
    	return $default;
    }

    Awesome! This has fixed the problem. Thank you for the help 🙂

    Plugin Author Andrea Tarantini

    (@dontdream)

    You are welcome, and thank you for your review!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Please give back ‘Range’’ is closed to new replies.