Skip to Content Skip to Menu

[SOLVED] DOB and Age

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264807 by krileon
Replied by krileon on topic DOB and Age
Age display on profile view doesn't require anything further than setting the date field to display as age, but profile edit is going to show as a date selector. This allows age to auto calculate as the years go by.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
9 years 5 months ago #264817 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
Yes, but as one can only be of one Type i.e. custom html or date, a more advanced substitution is required to have Date of Birth populate the separate Age field.

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

Please Log in or Create an account to join the conversation.

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
9 years 5 months ago #264841 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
Hello, the previous substitution that worked doesn't anymore in the sense that the date format is different.

It is set to dd/mm/yyyy in the original Date Type which is called Date of Birth, Birthday is the Custom Html with the substitution inserted [cb:userdata field="cb_dateofbirth" /]

Also - why is the substitution originally like an image with white background, stands out when behind that is the light grey - see first attachment.

Attached my results




Tried messing around with various settings and nothing works.

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9
Attachments:

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264864 by krileon
Replied by krileon on topic DOB and Age
Why are you trying to store the age separately? Sorry, I don't understand what you're trying to do. Create a date field and under Parameters > Display set "Profile View Display" to "Age". That's all you need to do. Profile edit will be the month, day, year dropdowns and profile view will be their age. There's no need for substitutions or anything of the sort. If you insist on using substitutions then please read the below tutorial carefully.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
9 years 5 months ago - 9 years 5 months ago #264932 by jpdenny1
Replied by jpdenny1 on topic DOB and Age
I'll keep it simple then. Forget about the age thing, either it can't be done or it's too difficult for me to do. From my first few posts I made it clear I wanted to draw the Age from the existing DOB database, your last post was one or the other, not what I was looking for.

Forget about background being white - I fixed it.


All I want to do is ask a User (when they are editing their profile) for their Date of Birth but instead of displaying 'Date of Birth' to display 'Birthday'. It works when I put 'Birthday [value]' into Profile Value Layout. BUT when I use substitutions like this: Birthday: [cb:userdata field="cb_dateofbirth" /] The Date Comes Out In A Different Format as my CB Configuration.This is my one and only issue.

Look I'll work around it, the reason for birthday instead of date of birth is that 'birthday' is nicer and less mechanical. The reason for the substitution is that I want to display member type, country and birthday - all substitutions, in a custom html part of their profile.

Note: Asking for someones birthday and date of birth are different in my opinion.

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9
Last edit: 9 years 5 months ago by jpdenny1.

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48477
  • Thanks: 8281
  • Karma: 1443
9 years 5 months ago #264933 by krileon
Replied by krileon on topic DOB and Age

I'll keep it simple then. Forget about the age thing, either it can't be done or it's too difficult for me to do. From my first few posts I made it clear I wanted to draw the Age from the existing DOB database, your last post was one or the other, not what I was looking for.

In order to utilize the features of a date field like its age display with an external value you'd need to query for the external value using CB Query Field. Next set a date field to the value of the CB Query Field using CB Auto Actions, but that's a bit much just for the DOB which would be easier if it was just stored with their profile data in CB.

You maybe also able to use SQL functions in CB Query Field to calculate the age with CB Query Field as well. See the below for SQL date functions.

dev.mysql.com/doc/refman/5.6/en/date-and-time-functions.html

All I want to do is ask a User (when they are editing their profile) for their Date of Birth but instead of displaying 'Date of Birth' to display 'Birthday'. It works when I put 'Birthday [value]' into Profile Value Layout.

You don't need to do this if you're using a Date field. Set the field title to "Date of Birth". Next under Parameters > Display set "Profile View Title" to "Birthday" or if you're using the Age usage you'd set this to "Age".

Birthday: [cb:userdata field="cb_dateofbirth" /] The Date Comes Out In A Different Format as my CB Configuration.This is my one and only issue.

That's because you're using "userdata" substitution, which is raw value and not formatted value. Formatted value is substituted in using the below usage.

[cb:userfield field="FIELD_NAME" /]

This is detailed in our substitution tutorial below.

www.joomlapolis.com/support/tutorials/107-use-cases/18353-using-substitutions-throughout-cb


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum