1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.4 User age and birthday

Discussion in 'XenForo Questions and Support' started by RichardKYA, Apr 19, 2015.

  1. RichardKYA

    RichardKYA Well-Known Member

    Is it possible to show just a user's age and not their birthday or day/month and have displaying their day/month as a separate option?

    Showing the day and month, but no age, doesn't make any sense at all and showing the age and being forced to show the entire birthday doesn't make sense either. Most people don't mind sharing their age with strangers or people they hardly know, but birthdays are usually private information, especially online.

    Basically, it needs to function backwards, "Show age?", then "Show day and month?", that way, if someone wants to keep their birthday private, they can, and if someone wants to show their birthday, they can and if another user wants to work out the year, they can. I don't think showing the year is necessary as it is, because if you're showing your age and then being forced to show the whole dd/mm/yyyy, the year isn't needed anyway because you're already showing your age.

    Is there a way to make this function with age first, then day/month optional?

    Thanks dudes and dudettes :)
     
  2. Mike

    Mike XenForo Developer Staff Member

    The logic in the UI generally reflects the logic in the code, so you'd need to be editing the code to change behaviors like this.
     
  3. RichardKYA

    RichardKYA Well-Known Member

    Yes. Do know what file contains the code that needs changing?

    Thanks
     
  4. DragonFlames

    DragonFlames Active Member

    ..just as a thought for you, it does mean nobody knows your Date of Birth from that info alone. It allows your birthday to be celebrated and mentioned without giving out your full DOB or age.

    One single birthday photo taken at any time in your life by anyone will usually have the date in the EXIF, and so your Birthday is normally out there for just about everyone these days.

    What isn't is the year of birth, though cakes and candles and so on may be giving that away too in many photos or notes posted on social media.

    I mention such things as it may save you some work if you reconsider, just ignore the thoughts if not helpful.

    Steve
     
  5. RichardKYA

    RichardKYA Well-Known Member

    Hello Steve,

    That's if you share your birthday photos and someone goes looking through the exif data. People could easily find out your bank details if they really wanted, but that doesn't mean you might as well just tell everybody online what they are lol

    I couldn't honestly see many people wanting to celebrate their birthday with people/strangers online, but if they did, they'd probably know them well enough to share their age anyway.

    I find that a lot of people don't mind sharing their age because it's allows them easily find people around their own age so they can make faster connections, but a lot of people are sensitive about sharing their exact birthday because it's personal information. I just find it odd that you can't show just your age only, but you can show your birthday without your age and to show your age you HAVE to show your birthday. It's like being able to mention your county/state and not your house number, but you can't talk about your house number without sharing your whole address lol

    I'll carry on working on changing it. It just makes more sense to me to have "age only" as an option, "birthday only" as an option and "both" as another option.

    Thanks for your comments though, I appreciate what you're saying, but I still think it needs changing :)
     
  6. sbj

    sbj Well-Known Member

    I'd say make a custom user field, a dropdown list, only with year of births. So years from 1900-2000 or something.
    Disable the default feature and enable the custom user field and make it as required.
    So the birth of year will be listed and nobody can know how old they are exactly, but still you know the range.
     
  7. RichardKYA

    RichardKYA Well-Known Member

    Hello @sbj,

    That's a different way to go I guess, but that means putting in around 70-100 years on a drop down list. Also, it doesn't help with the userBlurb that appears throughout the site in various places. Plus, people will have to go to someone's profile page, then to the information tab and then calculate someone's age just to figure out if they're around the same age.

    Thanks for the idea though :)
     
  8. Liam W

    Liam W Well-Known Member

    I made an add-on that will allow only the year to be displayed, I could change it to have an option to show age without the year as well.

    If you want to do it yourself, you need to look in the User model (I think).

    Liam
     
  9. RichardKYA

    RichardKYA Well-Known Member

    Hello @Liam W,

    Cool, I'll check that out

    Thanks :)
     
  10. RichardKYA

    RichardKYA Well-Known Member

    Hi guys,

    Just to let you know, I have got things how I them to be. What I did was pretty simple really lol

    In account_privacy_dob, I wrapped the input for "show day and month" in a div and set it visibility:hidden; and checked="checked" so that it's functionality remains but is unchangeable by the user.

    Code:
    <dt><a href="{xen:link 'account/privacy'}">{xen:phrase edit_your_privacy_settings}</a></dt>
       </xen:if>
       <dd>
         <ul>
           <li>
             <div style="visibility:hidden;">
             <label for="ctrl_show_dob_date"><input type="checkbox" name="show_dob_date" value="1" id="ctrl_show_dob_date" class="Disabler" checked="checked" /> {xen:phrase show_day_and_month_of_birth}</label>
             </div>
             <ul id="ctrl_show_dob_date_Disabler">
               <li><label for="ctrl_show_dob_year"><input type="checkbox" name="show_dob_year" value="1" id="ctrl_show_dob_year" {xen:checked "{$visitor.show_dob_year}"} /> {xen:phrase show_year_of_birth}</label><p class="hint">{xen:phrase this_will_allow_people_to_see_your_age}</p></li>
             </ul>
    
    I changed the phrase "show_year_of_birth" to "Show my age" and removed <p class="hint">{xen:phrase this_will_allow_people_to_see_your_age}</p> that shows below the check box.

    In member_view I commented out the default birthday field, so it doesn't show up when someone selects "Show my age"

    Code:
    <xen:comment>
                         <xen:if is="{$birthday}">
                         <dl><dt>{xen:phrase birthday}:</dt>
                           <dd>{xen:date $birthday.timeStamp, $birthday.format}</dd></dl>
                         </xen:if>
    </xen:comment>
    
    Then I created a 20 letter, single -line text box customField and set it to display on the "Personal Details" page.

    Screen Shot 2015-04-20 at 13.13.25.jpg Screen Shot 2015-04-20 at 13.13.30.jpg Screen Shot 2015-04-20 at 13.13.36.jpg

    So now, people can show there age in the userBlurb, without revealing their birthday anywhere else or if they want, they can just type in their birthday day/month and not reveal their age or they can do both if they want.

    Note: member_view is the only place that I have birthdays showing because I have already removed it in other templates, so if anyone else wants to do this, you'll have to remove/comment out the default birthday field from the other templates that have it as well.

    Thanks for your input and help :)
     
    sbj likes this.

Share This Page