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

    (@dontdream)

    Hi locomo,

    That feature is in my to-do list, but it requires rather extensive changes to the current plugin version, so I can’t tell when it will be available.

    If you are building a new site, you could define a Number field containing only the year of graduation (instead of a Date Selector field), and you could apply a Value Range search to that field.

    Thread Starter locomo

    (@locomo)

    ok thanks .. i’ll look into the number field option

    is there a hook that would let me write a override/customize how the date field is processed

    i’d be happy to try implementing this if there is a hook i can use

    Thread Starter locomo

    (@locomo)

    i hate modifying plugin files but i might need to temporarily in this case

    does this seem workable to you:
    in bps-search.php modify function bps_search to change case ‘datebox’ to:

    if ($min !== '')  $sql .= $wpdb->prepare ("AND value >= %f", $min);
    if ($max !== '')  $sql .= $wpdb->prepare ("AND value <= %f", $max);
    break;

    (instead of the current age calculation?)

    also as far as modifying your plugin, could there be a simple toggle in the admin area next to date fields that lets you choose either an age range or date range and then in function bps_search just check for the value of that option?

    thanks.. super helpful plugin!!

    Thread Starter locomo

    (@locomo)

    sorry for all the posts.. just want to confirm that the plugin hack above works

    one approach would be to include a new setting for date fields that let you choose between an age calculation or a date calculation (when creating your form in the backend). Then for case ‘datebox’ in function bps_search you could change how the SQL statement is prepared based on the setting value

    Plugin Author Andrea Tarantini

    (@dontdream)

    Hi locomo,

    Glad you found a suitable workaround!

    You are right, I should add a hook to allow filtering the SQL – taking note!

    And yes, the changes I had in mind involve changing the admin area and changing the search code. Changing the admin area is the most expensive change, because I also have to update the readme.txt, the online help, the screenshots, the documentation page on my site, …

    Thread Starter locomo

    (@locomo)

    totally understand, thanks

    i also tried the number field workaround and that is a viable option in the meantime

    Hi Locomo,
    I also need to search by date or date range instead of age.
    I would really appreciate if you could explain step by step your workaround to add that functionality to that great plugin (thank you Andrea).
    Many thanks

    Thread Starter locomo

    (@locomo)

    @albatros85

    i only needed Year (not a full date) so I wound up going with Andrea’s suggestion above – I used a number field for Year (instead of a date field) and then I was able to use the value range search on that field

    Many thanks, I’ll give it a go.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Date range (rather than age range)’ is closed to new replies.