-
Author
-
May 17, 2015 at 17:25 #59201maelgaParticipant
Hi, I have a few profile fields that currently display dates like this: 2016-01-02 00:00:00
How can I format all these dates to show in this format: DD MMM YYYY (e.g. 17 May 2015)?
Thanks
May 19, 2015 at 02:24 #59335LauraModeratorHello, have you tried the plugin https://wordpress.org/plugins/buddypress-xprofile-custom-fields-type/ ?
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
May 6, 2016 at 10:07 #120659LuukDriessenParticipantHello Laura,
We also make use of this plugin. But I can’t get it to work.
We are confused with the sweetdate options.
I use the correct code in the functions.php
When viewing memberspage, I get the date and time instead of the age.
Als when viewing the profile i get: Dat of Birth intead of ‘Age’. The age self is showing correctly.
Which sweetdate options do I need to use?
May 9, 2016 at 20:16 #121061LauraModeratorHello, if you go to Sweetdate > Buddypress, you will find the age field selector and you will also see the use age instead of birthday checkbox
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
May 9, 2016 at 22:29 #121078LuukDriessenParticipantHello Laura,
Yes, ofcourse.
We use Xprofile to show the date of birth field.
We succesfully showed the age on the members profile.
Question 1: What do I have to do to show ‘Age’ instead of ‘DateofBirth’
Question 2: Which code do I need to use to show the ‘Age’ on the members overview page?
When activating in theme the Xprofile plugin shows the DateofBirthThanks in advance.
We had all these functions working correctly without Xprofile plugin.
So now we need to use another code?May 11, 2016 at 02:05 #121278LauraModeratorHello, at Sweetdate > Buddypress and you will see birthday and the check show age instead of birthday
Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
May 11, 2016 at 14:49 #121332LauraModeratorHello, will assign the ticket to a higher support level who can help and advise you in your query.
Thanks! 🙂Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionLaura Solanes - Graphic Designer and Web Designer
Please be patient as I try to answer each topic as fast as i can.
If you like the theme or the support you've received please consider leaving us a review on Themeforest!
Always happy to help you 🙂
May 11, 2016 at 17:52 #121371RaduModeratorHi,
Try to use date() instead the time() it seems that the time add extra details like hours:minutes:seconds
Similar topic here : https://archived.seventhqueen.com/forums/topic/xprofile-fields-plugin-compatability-with-sweet-date
http://stackoverflow.com/questions/2829120/mktime-php-date-timestamp-yyyy-mm-dd
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solutionMay 12, 2016 at 00:31 #121443LuukDriessenParticipantHello Radu,
Thank you for your reply. Really appreciate the support.
I tried to use the changes. The same problem occurs.
add_filter( ‘bp_get_the_profile_field_value’, ‘kleo_get_field_value’, 1, 2);
Question: Which ID’s I need to select? Ofcourse the field_id of the dateofbirth. But what about the other ID?The settings in the theme don’t make sense since using Xprofile.
May 12, 2016 at 18:22 #121533RaduModeratorHi again,
Try with this
COPY CODEadd_filter( 'bp_get_the_profile_field_value', 'kleo_get_field_value', 999, 3); function kleo_get_field_value($value, $type, $field_id) { if ($type == 'datebox') { $field = new BP_XProfile_Field($field_id); $birthdate = new DateTime($field); $today = new DateTime('today'); $age = $birthdate->diff($today)->y; return $age; } return $value; }
Cheers
R.Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution -
AuthorPosts
The forum ‘Sweetdate – WordPress’ is closed to new topics and replies.