This topic has 11 replies, 3 voices, and was last updated 10 years by hughm.

  • Author
  • #8044
     hughm
    Participant

    All of the search fields in my member search (member type, city, gender) work great except for the age range search. I am using a custom registration form (Gravity Forms Registration Add On) which populates the birthdate field correctly on the member profile but for some reason is not working in the member search. Only after new users go back to the profile and resave the birthdate does the age range search work. Any best practice on getting the age range search to work would be most appreciated!

    #8079
     hughm
    Participant

    I noticed that there is an Age field on the SweetDate Administration Form (SweetDate > Buddypress). Is it possible to generate the member’s age from their Birthdate entry? If so how do you do this? I am guessing this is why my age range search isn’t working, because maybe I haven’t set up the age field properly? Thanks!

    #8107
     Abe
    Keymaster

    Hi, That age field from SweetDate > Buddypress is responsible for displaying user age in Members directory and also to render the two selectboxes in the Search form.
    The data from Gravity forms should be saved in the Birthdate field you set as Age field. Maybe GF isn’t saving the data right since the form searches in database in the saved fields.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #8118
     hughm
    Participant

    Thanks Abe,
    So on the Sweetdate>Buddypress Admin page I should set both the “Select Age Range Field” to my Birthday XProfile field and I should set the “Age Field” also to the same Birthday Xprofile field? The reason for the confusion is because there is a plugin called Buddypress XProfile Custom Field Types which can generate the member age which I am actually using.

    Regarding the GF issue, you are right. I looked at the database and the GF birthdate is displaying in the member profile but it is not saving correctly to the database. An entry for March 22 1985 ends up displaying as 480297600 for example. I believe that it is a problem with the month being an integer in GF (1-12) and a string (January etc) in BP. Will try to remedy!

    #8123
     adam
    Participant

    hi @hughm – if you figure this out, can you share how you did it? i’d like to do the same. thanks!

    #8133
     hughm
    Participant

    Sure. I did a bit more investigation and submitted multiple new users using different settings. The date format doesn’t seem to be the problem. The correct date displays in the member profile but is incorrect in the db regardless of whether it is dd-mm-yyyy or any other combination. Only after resaving from the profile does it show up correctly in the db. So no forward progress here.

    #8188
     hughm
    Participant

    It turns out Gravity forms is saving the member birthdate to the db in the timestamp format which looks like 480297600. Buddypress default registration saves the birthdate in the MySQL date format which looks like: 2012-02-23 06:12:45.
    Buddypress reads both formats so it is able to display the birthdate correctly in the member profile (ie March 22 1985). However the BP Profile Search plugin is not able to read this format and only reads MySQL date formats. This is why the age range search is not working.
    Unfortunately Gravity Forms does not support compatibility with other plugins, and because their format works with Buddypress their support cannot help to convert their format.
    So to make the SweetDate Age Search compatible work with Gravity Forms either the GF db birth-date entry needs to convert to the MySQL date format or the BP Profile Search plugin needs to be able to convert the timestamp format to MySQL date format. Not sure how to do this. Open to ideas. I do think that many people will want to use Gravity Forms Registration Add On with SweetDate so it will be a benefit to figure it out.

    #8227
     hughm
    Participant

    I posted to the BP Profile Search plugin support and found out that you can use an older version of BP Profile Search (version 2.7) which uses the old Unix timestamp format.
    The best solution however is to have the custom registration form save the MySQL date format to the db which works for Buddypress and the current version of the BP Profile Search.

    #8236
     Abe
    Keymaster

    Try replacing this file contents wp-content/themes/sweetdate/custom_buddypress/kleo-bp-search.php with https://archived.seventhqueen.com/files/kleo-bp-search.txt

    See if the search works.

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    ---
    @ SeventhQueen we do our best to have super happy customers. Thanks for being our customer.

    #8250
     adam
    Participant

    hi @hughm – The age range in BP Profile Search works for me when I register on my site (using Gravity Forms).

    Here’s my setup:

    I have a Gravity Forms field for Date of Birth which is just a date field with date format mm/dd/yyyy. It’s then linked to the Date of Birth field I created in Buddypress under Gravity Form’s User Registration. In Buddypress, the Date of Birth field I use is a Birthdate field type from Buddypress Xprofile Custom Fields Type (I also have show age instead of birthdate checked though I doubt this matters).

    #8282
     hughm
    Participant

    @adam you are correct. I just tested it and the Buddypress Xprofile Custom Fields plugin does the trick. The date is entered in the MySQL date format in the database. So the Buddypress Xprofile Custom Fields plugin must save to the db with this format.
    One small thing to note, the MySql date format using this plugin does not include the time values so the date displays in the db as yyyy-mm-dd whereas the Buddypress default registration form db entries contain the time values yyyy-mm-dd hh:mm:ss.

    I am going to do a bit more testing and will add to this entry if there are any problems, otherwise looks like you solved it. Thanks a lot!

    #8284
     hughm
    Participant

    @adam you are correct. I just tested it and the Buddypress Xprofile Custom Fields plugin does the trick. The date is entered in the MySQL date format in the database. So the Buddypress Xprofile Custom Fields plugin must save to the db with this format.
    One small thing to note, the MySql date format using this plugin does not include the time values so the date displays (mm-dd-yyyy) whereas the Buddypress default registration form db entries contain the time values (mm-dd-yyyy hh:mm:ss)

    I still however cannot get the age search to work. The new Birthday field does not appear on the SweetDate/Buddypress page in the Select Age Range Field drop down. Instead where the drop down used to be it says “There is no date field”. I will keep testing and drop a note if I get it to work.

Viewing 12 posts - 1 through 12 (of 12 total)

The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?